|
-
Jun 1st, 2004, 03:58 AM
#1
Thread Starter
Hyperactive Member
Safe String Code
Hey,
How to make function which removes all unsafe charters, removes spaces, converts international letter to latin etc, and retuns only latin letters and numbers (alphasimbols)?
Also this function should reduce lenght of the string to n simbols.
ETC.:
dim str as string = "<*> Hello 10 people, how are you!? <*>"
str = myfunction(str, 8)
And then Str value is equl to = "he10phay"
If lengt of string is more then 8 after removing unsafe charters, it cuts some characters of every world until it's lengt is 8.
Any suggestions?
Maybe .NET has function which convers string to alpha string?
-
Jun 1st, 2004, 12:25 PM
#2
Sleep mode
I don't know how to do that but Regular Expression can help you .
-
Jun 1st, 2004, 03:04 PM
#3
PowerPoster
Re: Safe String Code
Originally posted by Norkis
Hey,
How to make function which removes all unsafe charters, removes spaces, converts international letter to latin etc, and retuns only latin letters and numbers (alphasimbols)?
Also this function should reduce lenght of the string to n simbols.
ETC.:
dim str as string = "<*> Hello 10 people, how are you!? <*>"
str = myfunction(str, 8)
And then Str value is equl to = "he10phay"
If lengt of string is more then 8 after removing unsafe charters, it cuts some characters of every world until it's lengt is 8.
Any suggestions?
Maybe .NET has function which convers string to alpha string?
Heavens! Your mind is even more twisted than mine Let's have a go.
1. "How to make function which removes all unsafe charters, removes spaces,"
Compare each character with the appropriate range of ASCII values and reject as necessary.
2. "converts international letter to latin etc, and retuns only latin letters and numbers (alphasimbols)?"
Not sure what you mean. i.e. convert e.g. Cyrillic script to Latin? Convert Arabic to Latin? Convert Chinese to Latin?
3. "Also this function should reduce lenght of the string to n simbols"
Find the length of the converted string: divide it by n: get each n th character from the string.
May I ask the purpose of this?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 1st, 2004, 03:13 PM
#4
Thread Starter
Hyperactive Member
I'm creating universal registration form, whis stores all data in DB.
Then user create new field, he enters it's title.
Title can consist anything, like "‡ Surname (Pavardë) Ñ"
I cant create table with column name like this title, so I want to convert it so safe, but readable for me.
Hum, I think it would be large funtion, with several loops...
No way to make it shorter?
-
Jun 1st, 2004, 06:28 PM
#5
PowerPoster
Originally posted by Norkis
I'm creating universal registration form, whis stores all data in DB.
Then user create new field, he enters it's title.
Title can consist anything, like "‡ Surname (Pavardë) Ñ"
I cant create table with column name like this title, so I want to convert it so safe, but readable for me.
Hum, I think it would be large funtion, with several loops...
No way to make it shorter?
But surely the user will want to see the field name as he originally entered it? So, why not create a table which holds in one column the name as entered (as many characters as entered); in another column the name you allocated (8 characters long); in another column the table to which the names refer. Then, when you want to display the information in future, you simply have to cross reference.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 1st, 2004, 11:20 PM
#6
Thread Starter
Hyperactive Member
This is exactly what I'm doing.
-
Jun 2nd, 2004, 04:31 AM
#7
PowerPoster
Originally posted by Norkis
This is exactly what I'm doing.
Then the quickest way would be to keep note of how many columns are being created and name them Column1, Column2 ..etc e.g. strCol="Column" & str(val(iCol)) (or use casting if you prefer)
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 2nd, 2004, 04:41 AM
#8
Thread Starter
Hyperactive Member
But then it would be harder, if I have to modify something manualy.
-
Jun 2nd, 2004, 05:05 AM
#9
PowerPoster
Originally posted by Norkis
But then it would be harder, if I have to modify something manualy.
Sorry, I don't follow you. You will have just simplified the way of naming your data table column. Nothing else will be different.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 3rd, 2004, 01:00 AM
#10
Thread Starter
Hyperactive Member
Ok. I tryied to name my columns in simple way (column1, column 2 ...)
Now I got new problem:
Imagine, That I create two fileds (columns).
It will be Column1 and Column2 (Column name consists word "Column" & item.index in datalist)
Then I remove the first one, so there are only Column2 left.
I got error, when I try to add new one, becource the name Column2 already exist.
How to solve this?
-
Jun 3rd, 2004, 04:30 AM
#11
PowerPoster
Originally posted by Norkis
Ok. I tryied to name my columns in simple way (column1, column 2 ...)
Now I got new problem:
Imagine, That I create two fileds (columns).
It will be Column1 and Column2 (Column name consists word "Column" & item.index in datalist)
Then I remove the first one, so there are only Column2 left.
I got error, when I try to add new one, becource the name Column2 already exist.
How to solve this?
hI,
How about using an autonumber as your key field in the reference table we referred to and using that as the addition to "Column"
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 3rd, 2004, 05:42 AM
#12
Thread Starter
Hyperactive Member
Good idea! Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|