Advertisement
Java_Volume1 String Manipulation #90127

Trim non alphanumeric characters FAST

It will erase any non-alphanumeric characters from a string rapidly. Usefull if you want to check strings for non-valid characters. Strings such as email or web addresses, you can even make so that only numbers can be entered in, for example, a text box.

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Function TrimVoid(strWhat)
'*************************
'Usage: x = TrimVoid(String)
'*************************
'Example: Chunk = TrimVoid(Chunk)
'Filters all non-alphanumeric characters from string "Chunk".
'*************************
For i = 1 To Len(strWhat)
If Mid(strWhat, i, 1) Like "[a-zA-Z0-9]" Then strNew = strNew & Mid(strWhat, i, 1)
Next
TrimVoid = strNew
End Function
'NOTES - replace the above code with the lines below to get the wanted results.
'For trimming email addresses use this:
'Like "[a-zA-Z0-9._-]"
'For trimming web addresses use this:
'Like "[a-zA-Z0-9._/-]"
'To accept only numbers in a text box use this in the text box's Change Sub:
'Like "[0-9]"
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine