English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i have a text for example: "m1234erfvvg678"

is it possible for me to display only "m1234" ?????

2007-03-21 20:35:14 · 3 answers · asked by Johnny B 1 in Computers & Internet Programming & Design

what if the string value is taken from a database table where the length of the string is unknown??

2007-03-21 20:38:22 · update #1

3 answers

well what language r u using :
if sql : substring(fieldname,1,5)
if .net : x=filedname
x=x.substring(0,5)

2007-03-21 20:43:28 · answer #1 · answered by 14Me14U 2 · 0 0

If you have a string of unknown length in a database then it is known as a variable length string. It will probably have a maximum length and it will also have a length!

If you want the first five bytes of the string then first find the smaller of database string length and 5.
Now use the substring function outside of the sql to access from char 1 to char smallest.

2007-03-22 04:19:34 · answer #2 · answered by AnalProgrammer 7 · 0 0

Just make another string containing first 5 characters

2007-03-22 04:47:56 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers