private String post_content = "fromid=#fromid#”
现在我post_content.replace( "#fromid#" ,"123" ),怎么替换不了呢,看了下api,也不明白
#应该没什么特殊含义啊

解决方案 »

  1.   


    public class Test {
    public static void main(String[] args){
    String post_content = "fromid=#fromid#";
    System.out.println(post_content.replace( "#fromid#" ,"123" ));
    }
    }
      

  2.   

    post_content.replace( "fromid#" ,"123" )
    格式错了
      

  3.   

    可以替换吧 ,post_content.replace( "#fromid#" ,"123" ) 左边是一个全角#,而表达式#fromid#是一个半角,当然找不着了,换成半角试就好了
      

  4.   

    String post_content = "fromid=#fromid#";
    post_content=post_content.replace("#fromid#", "123");
    这样的。替换后,还要把结果赋值给一个变量,不然,替换后,就没了,他不是在原字符串的替换的