Hey!
I have a string str = "12354" . i want to create another string str2 with only the first two elements of the string str
ie i want str2 = "12". can someone please tell me how i can do that?

Member Avatar for iamthwee

Use substr()

google it.

i got it.Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.