Results 1 to 4 of 4
  1. #1
    mukeshgulia is offline Member
    Join Date
    Dec 2010
    Posts
    3
    Rep Power
    0

    Default replacing last char of string logics

    hi all,

    i need to replace the last char of string by a ")"

    i did this..
    Java Code:
    query = query.substring(0,query.length()-1)+")";
    and my manager wants something else other than (query.length -1)!!
    what cud be the other way around which is better than this.

    this is the complete code list:
    Java Code:
    query+="SELECT EXTID , REPLACE(ICI_ID, ' ', '') ICI_ID, CPY_SID, LINE_NUMBER"; 
    query+=" FROM TEMP_OTC_CSA_ID, COUNTERPARTY";
    query+=" WHERE REPLACE(ICI_ID, ' ', '') IN (EXTERNAL_ID,BIC_CODE)"; 
    query+=" AND SOURCE_ID IN (";
    String cpySrc[] = cpySource.split("\\,");
    for(int i=0; i<cpySrc.length; i++){
           query+= "'"+cpySrc[i]+"',";
    }
    query = query.substring(0,query.length()-1)+")";
    query+=" ORDER BY LINE_NUMBER, EXTID";

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Maybe he wants you to use charAt.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,304
    Rep Power
    20

    Default

    my manager wants something else
    The word is teacher

    db

  4. #4
    mukeshgulia is offline Member
    Join Date
    Dec 2010
    Posts
    3
    Rep Power
    0

    Default

    in the end we need to go to last charcter.
    length fun is i guess needed.

Similar Threads

  1. Replacing a char with the next
    By hiei_yasha in forum New To Java
    Replies: 14
    Last Post: 01-15-2011, 02:12 AM
  2. check a string char by char
    By Sotsiak in forum New To Java
    Replies: 2
    Last Post: 10-23-2010, 09:24 PM
  3. Replacing char in string help
    By jimmy-lin in forum New To Java
    Replies: 3
    Last Post: 10-12-2009, 06:01 AM
  4. Replacing the chars within a string.
    By Mayur in forum New To Java
    Replies: 2
    Last Post: 03-27-2009, 04:00 AM
  5. Help Replacing String
    By 7oclock in forum New To Java
    Replies: 5
    Last Post: 02-14-2009, 07:31 AM

Posting Permissions

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