#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    13
    Rep Power
    0

    Cutting and Splicing Strings


    So I'm pretty much a newb with programming and need some help with cutting segments of a string w/ unknown length then replacing that cut section to the remaining string.
    Example: [T]urtles --> urtles[T] or [Tur]tles --> tles[Tur]

    here is my code I've been trying to accomplish the above task with

    String sFirst = first.substring(1,(first.lastIndexOf(' ')));

    also tried

    String sFirst = first.substring(first.lastIndexOf(' ')+1);

    any ideas what I could be doing wrong?
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,022
    Rep Power
    1285
    Why are you looking for the location of ' '?

IMN logo majestic logo threadwatch logo seochat tools logo