Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

how to remove white spaces from a string ?

jayapradajayaprada Posts: 29Registered Users
edited December 2008 in iOS SDK Game Development
Hi,


can any one tell how to remove white spaces from a string ?

I am reading string value from xml but it is giving white spaces bit I don't want that.
can any one tel lthe solution?


thanks
Jaya
Post edited by jayaprada on

Replies

  • rajuraju Posts: 61Registered Users
    edited December 2008
    jayaprada wrote: »
    Hi,


    can any one tell how to remove white spaces from a string ?

    I am reading string value from xml but it is giving white spaces bit I don't want that.
    can any one tel lthe solution?


    thanks
    Jaya

    Hello,

    Try this
    yourString = [yourString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

    Thanks,
    Raju.
  • jayapradajayaprada Posts: 29Registered Users
    edited December 2008
    Hi Raju,



    We did the sameway. it works . great.



    Thanks
    Jaya
  • mehulparmar4evermehulparmar4ever AHMEDABADPosts: 1New Users Noob
    hello dear frds...
    there`s one problem , plz help me..

    here, the code is like given below..

    NSLog(@Pathforimage = %@",Pathforimage);
    NSMutableArray *sss = [_dataDictionary objectForKey:@moment_img];
    NSLog(@sss =%@",sss);

    NSString *STT=[NSString stringWithFormat:@%@",sss];
    NSLog(@STT=%@",STT);

    O/P is...

    2014-06-24 16:54:17.660 Omoment[7140:60b] Pathforimage = /Users/Mac/Library/Application Support/iPhone Simulator/7.1/Applications/56551EF0-151C-4CCB-A017-C3C18AA49D2A/Documents/Images
    2014-06-24 16:54:17.661 Omoment[7140:60b] sss =(
    "1403602768513,1403602768533"
    )
    2014-06-24 16:54:17.661 Omoment[7140:60b] STT=(
    "1403602768513,1403602768533"

    & i want is something like ...
    2014-06-24 16:54:17.661 Omoment[7140:60b] want=1403602768513,1403602768533

    finally need help...
  • rajeev_etdrajeev_etd GuragaonPosts: 2New Users Noob
    Try this,
    NSLog(@STT = %@", STT[0]);
    Hope it help.
Sign In or Register to comment.