Page 1 of 1

seperating a string

Posted: Wed Feb 18, 2009 10:43 am
by shoaib
hello

i want to seperate a string,

i mean if a value passed in the form like srb123 34rb5

i want a function who can seperate a string and integar and echo it seperately

like (srb ) and (123) first example
like (345) and (rb) second example

i am waiting for the reply
thanks
shoaib

Re: seperating a string

Posted: Wed Feb 18, 2009 10:53 am
by prometheuzz
shoaib wrote:hello

i want to seperate a string,

i mean if a value passed in the form like srb123 34rb5

i want a function who can seperate a string and integar and echo it seperately

like (srb ) and (123) first example
like (345) and (rb) second example

i am waiting for the reply
thanks
shoaib
If you're not familiar with regex, I wouldn't use it.
If you are familiar with it however, please ask a specific question about it. I mean, now it just looks like you're trying to find someone to do your (home) work. The saying "learn a man to fish instead of feeding him" applies here nicely, IMO.

So, if you post what you have already tried yourself and explain what went wrong with it, I'm more than happy to give you a hand with it. But, you can also just ignore me and wait for someone else to hand you a copy-and-paste answer. You decide!

Good luck!

Re: seperating a string

Posted: Wed Feb 18, 2009 11:03 am
by shoaib
buddy i new to php i m learning it but i m stuck here if have tried different loops but simply don't get the result .

i just want to know the way how to do it.

thanks for the reply
prometheuzz wrote:
shoaib wrote:hello

i want to seperate a string,

i mean if a value passed in the form like srb123 34rb5

i want a function who can seperate a string and integar and echo it seperately

like (srb ) and (123) first example
like (345) and (rb) second example

i am waiting for the reply
thanks
shoaib
If you're not familiar with regex, I wouldn't use it.
If you are familiar with it however, please ask a specific question about it. I mean, now it just looks like you're trying to find someone to do your (home) work. The saying "learn a man to fish instead of feeding him" applies here nicely, IMO.

So, if you post what you have already tried yourself and explain what went wrong with it, I'm more than happy to give you a hand with it. But, you can also just ignore me and wait for someone else to hand you a copy-and-paste answer. You decide!

Good luck!

Re: seperating a string

Posted: Wed Feb 18, 2009 11:07 am
by prometheuzz
shoaib wrote:buddy i new to php i m learning it but i m stuck here if have tried different loops but simply don't get the result .

i just want to know the way how to do it.

thanks for the reply
No problem.

Re: seperating a string

Posted: Thu Feb 19, 2009 2:57 am
by GeertDD
shoaib wrote:buddy i new to php i m learning it but i m stuck here if have tried different loops but simply don't get the result.
Well, you could do it without regex if you want to. Loop over each character, do a ctype_digit check and fill two strings.