Results for "Category: String Manipulation"
You can use ADO GetRows to output and ADO recordset to an array. This is often useful in n-tier applications when you are moving data between tiers--or if you want to persist your data in another way. http://adozone.cnw.com/default.htm
Transactions are atomic operations that allow you to do multiple operations on a database as one operation. For example, if you were creating a banking application in which you deducted $100 from one account and added it to another account, you wouldn't want the operation to fail right in the middle, because the money would be 'lost'! The solution is to wrap the SQL in a transaction. If the operation is aborted in the middle (the pc gets shut off for example) the database will rollback the changes so that the initial account was never debited the $100. This will make you feel good, especially if its your bank account!
Since ASP is especially good at reading and writing to databases, let's start with a very simple database and scripts that we'll eventually build into a guestbook... Reprinted with permission from http://www.web-savant.com/users/kathi/asp
This is not real RDS but a simulation (Like Access's Not_In_List event). This functions gives the user the ability to 1) Add a new Value into a Database table and 2) update and select the value in the combobox WITHOUT REFRESHING the page from the server. I found this to be a life saver with large ASP pages with comboboxes on them that need to be dinamicaly filled. (You don't have to worry about the controls on the pages)
Compresses strings, most effective on bitmap files
This short and sweet function accepts a string containing text to be spell checked, checks the text for spelling using MS Word automation, and then returns the processed text as a string. The familiar MS Word spelling dialog will allow the user to perform actions such as selecting from suggested spellings, ignore, adding the word to a customized dictionary, etc.
This is a class module that performs regular expression searches in a string.
Want to sort 5,000 10-byte strings in about 1/10th of a second? This will do it (at least on my PII-233!). The insertion sort manages the same task in about 60 seconds (even when optimized it still took about 15 seconds on the same machine).
This routine was designed to act as a numbers-only mask for any TextBox Keypress event. Simply call it from any KeyPress event and feed it the KeyAscii return value.
This code duplicates the functionality of VB6's split function.
RECURSIVE DESCENT PARSER FOR NUMERIC EXPRESSIONS
Converts a name or word string to a four digit code following Soundex rules. Similar code is used by geniological groups and the US Census Bureau for looking up names by phonetic sound. For example, the name Darrell can be spelled many different ways. Regardles of how you spell it, (Daryl, Derrel, Darel, etc.) the Soundex code is always D640. Therefore, you assign a field in your database to the Soundex code and then query the database using the code, all instances of Darrell regarless of spelling will be returned. Refer to the code comment section for more information.
This is a recursive function that evaluates strings expressions. It supports multiple levels of parenthesis, algebraic evaluation of expressions (in this example exponentiation ^ has same level of multiplication and division), function calls, logical operators, string/date/numeric functions and expresion evaluation. This is the base for the creation of a scripting language.
Convert a string in EBCDIC format downloaded from an IBM mainframe to ASCII format.
Convert ASCII strings into EBCDIC code to upload into an IBM mainframe. This code may be used also as a basic encrypting method. Both ASCII to EBCDIC and EBCDIC to ASCII are included in this code.
format a text field into a $ currency field.
This example I put together teaches you how to use the InStr function with a string. InStr is very important to use because you can get certain information from a String by using it. Example: say a String has your first and last name in it like "Mike Canejo". InStr allows you to get just the last name or first name. First and Last name are just an example. You could do tons of things with Instr. This is very important for a beginner to know trust me. You'll be surprized if you end up using it in your next vb project :)
This code recieves RTF code as output by a Rich Text Box in VB or MS Word. It outputs the equivalent in HTML. It's in a somewhat BETA form in that it handles a number of but not all of the possible codes. If you encounter a code it doesn't properly convert just send it to me and I'll try to fix the function within 24 hours. I think it does a better job on uncomplicated text than MS Word's HTML conversion.
Visual Basic 6 has a new function called InStrRev, which searches a string from right to left. I found it very usefeul, so much so that a project of mine relies completely on it. When I tried to work on the project at another location on VB5 I found that the function did not exist. So, I wrote it. I left out the compare method, you can add it if you want
This shows you how to search for a "string" inside of a "string" to see if it's there or not. This makes a good E-mail validator.. If the user doesn't put the "@" character, this will know it's not there and return false. This also works the same way if your trying to validate a Full Name. I commented everyline so enjoy and good luck.-Mike