SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: cut string

  1. #1
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cut string

    How can I remove or replace string

    for example

    $string= 222111.pdf

    i want string be(remove or replace .pdf with .txt)

    222111.txt

    ??

  2. #2
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    $string =~ s/pdf$/txt/;

    this is pretty basic

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried this and no thing changed


Bookmarks

Posting Permissions

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