Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. PHP string truncation

PHP string truncation

Scheduled Pinned Locked Moved Web Development
helpc++phpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tibiz
    wrote on last edited by
    #1

    Hello, I need help with a simple problem: if I read a text from a file (PHP) $text=fgets(...) variable, say we it's having about 3000 characters, how can I trunate it to a fixed length so I'll get a shortcut :-) something like char *text="aaaaaaaaaaaaaaaaaaaaaa"; text[10]='\0'; in C++ thanx a lot

    T 1 Reply Last reply
    0
    • T tibiz

      Hello, I need help with a simple problem: if I read a text from a file (PHP) $text=fgets(...) variable, say we it's having about 3000 characters, how can I trunate it to a fixed length so I'll get a shortcut :-) something like char *text="aaaaaaaaaaaaaaaaaaaaaa"; text[10]='\0'; in C++ thanx a lot

      T Offline
      T Offline
      Ted Ferenc
      wrote on last edited by
      #2

      substr possibly?


      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      T 1 Reply Last reply
      0
      • T Ted Ferenc

        substr possibly?


        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        T Offline
        T Offline
        tibiz
        wrote on last edited by
        #3

        very simple :) thanx a lot

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups