By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

separating variables from one input

P: n/a
Information is entered randomly in just one text box (name, social security
number, lenght,weight).

The problem is how to recognize that what actually was the name, and what
was lenght etc.

So how can i separate the inputs in their own variables?

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello,

<mh> wrote:
Information is entered randomly in just one text box (name, social
security number, lenght,weight).

The problem is how to recognize that what actually was the name, and what
was lenght etc.

So how can i separate the inputs in their own variables?


This is only possible if you can define clear rules yourself
how a program could recognize which information is in a certain
piece of the string. But I think in this case you can.

Social Security Number
I guess this one typically has a fixed format with a
fixed number of digits, totally different from the
expected values of length and weight.

Length
Would typically be a number in a
lower range than weight.

Weight
Would typically be a number in a
higher range than length.

Name
Would be the other field. Probably shouldn't contain
any numbers and have a certain minimum length.

For the string in which the information is entered,
you have to decide on which characters you interpret
as delimiters. Then just split the string on that,
loop through the elements, check what each element
most looks like and put the value of the element
in the corresponding variable.

Best regards,

Eric
Jul 17 '05 #2

P: n/a
On Wed, 29 Oct 2003 11:11:03 +0100, Eric Veltman
<eric@[RemoveThis]veltman.nu> wrote:
Hello,

<mh> wrote:
Information is entered randomly in just one text box (name, social
security number, lenght,weight).

The problem is how to recognize that what actually was the name, and what
was lenght etc.

So how can i separate the inputs in their own variables?
Length
Would typically be a number in a
lower range than weight.

Weight
Would typically be a number in a
higher range than length.


Do the length and weight elements contain a unit? e.g. 15kg, 4in, etc?

That would make identifying them easier, but also opens the quesiton
of what units are allowable. Is the user restricted to, say, inches,
or can they also enter centimetres, furlongs, miles, etc. Are mixed
units allowable, e.g. 5ft9in, or even 7ft3cm ?

--
David ( @priz.co.uk )
The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
The Tarbrax Chronicle: http://www.tarbraxchronicle.com/
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.