Results 1 to 9 of 9

Thread: string Manipulation

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    string Manipulation

    Hi,
    i have a string and a avalue like below.
    Dim sTemp as String="GWIWJF+TheSansSemiBold-Plain
    16 dict begin
    /FontName /GWIWJF+TheSansSemiBold-Plain_00 def
    /FontType 1 def"

    i need to replace the first line of this string, without looping is there any way to do this.

    sTemp = "16 dict begin
    /FontName /GWIWJF+TheSansSemiBold-Plain_00 def
    /FontType 1 def"
    Last edited by vijy; Dec 2nd, 2010 at 12:12 PM.
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,416

    Re: string Manipulation

    which part? just GWIWJF?

  3. #3
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: string Manipulation

    May i suggest getting a more updated version of visual basic? The express edition is free.

    you can do STRINGNAME.replace("REPLACETHIS", "WITHTHIS")


    --------------------
    Sorry I can't help you here.
    Last edited by crazy1993; Dec 2nd, 2010 at 12:36 PM.
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,416

    Re: string Manipulation

    try this:

    vb Code:
    1. Dim sTemp As String = "GWIWJF+TheSansSemiBold-Plain" & _
    2.                                 "16 dict begin" & _
    3.                                 "/FontName /GWIWJF+TheSansSemiBold-Plain_00 def" & _
    4.                                 "/FontType 1 def"
    5. sTemp = sTemp.Remove(0, sTemp.IndexOf("16"))
    6. MsgBox(sTemp)

  5. #5

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: string Manipulation

    Quote Originally Posted by .paul. View Post
    which part? just GWIWJF?
    no.. i need to replace the first line or we can tell first enter mark.
    Visual Studio.net 2010
    If this post is useful, rate it


  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,416

    Re: string Manipulation

    vb Code:
    1. Dim sTemp As String = "GWIWJF+TheSansSemiBold-Plain" & ControlChars.Cr & _
    2.                         "16 dict begin" & ControlChars.Cr & _
    3.                         "/FontName /GWIWJF+TheSansSemiBold-Plain_00 def" & ControlChars.Cr & _
    4.                         "/FontType 1 def"
    5. sTemp = sTemp.Remove(0, sTemp.IndexOf(ControlChars.Cr))
    6. MsgBox(sTemp)

  7. #7

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: string Manipulation

    Quote Originally Posted by .paul. View Post
    try this:

    vb Code:
    1. Dim sTemp As String = "GWIWJF+TheSansSemiBold-Plain" & _
    2.                                 "16 dict begin" & _
    3.                                 "/FontName /GWIWJF+TheSansSemiBold-Plain_00 def" & _
    4.                                 "/FontType 1 def"
    5. sTemp = sTemp.Remove(0, sTemp.IndexOf("16"))
    6. MsgBox(sTemp)
    huh,, my string is dynamic one... only first new line is the thing,..
    Visual Studio.net 2010
    If this post is useful, rate it


  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,416

    Re: string Manipulation

    see post #6

  9. #9

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: string Manipulation

    Quote Originally Posted by .paul. View Post
    see post #6
    Thanks paul.
    Visual Studio.net 2010
    If this post is useful, rate it


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