Results 1 to 2 of 2

Thread: [RESOLVED] String Replace...

  1. #1

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Resolved [RESOLVED] String Replace...

    can somebody tell me what the error in this code is please?

    Code:
    // NOTE:
    // client.sSpaceRep = "%20";
    
    	public String EncodeChatMsg(String ChatMsgIn){
    		String sReplace;
    		// Start the process of editing the message
    		sReplace = ChatMsgIn;
    		// Find any double spaces
    		while(sReplace.indexOf("  ") != -1){
    			// change the double to single space
    			sReplace.Replace("  "," ");
    		}
    		// replace single spaces with %20
    		sReplace.Replace(" ",client.sSpaceRep);
    		// Return the edited msg
    		return sReplace;		
    	}

    Code:
    C:\Programming\TheWalks\TheWalksChat\JavaChat\chatclient\ClientInterface.java:253: cannot resolve symbol
    symbol  : method Replace (java.lang.String,java.lang.String)
    location: class java.lang.String
    			sReplace.Replace("  "," ");
                                    ^
    C:\Programming\TheWalks\TheWalksChat\JavaChat\chatclient\ClientInterface.java:255: cannot resolve symbol
    symbol  : method Replace (java.lang.String,java.lang.String)
    location: class java.lang.String
    		sReplace.Replace(" ",client.sSpaceRep);
                            ^
    Wayne

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width