Advertisement

Results for "Category: String Manipulation"

6_2008-2009 #211195
Hex Output

Generates text on the right side and the hex output on the left side. ex. 0D 0A 44 61 74 65 3A 20 54 68 75 2C 20 30 38 20 | ..Date: Thu, 08

6_2008-2009 #211205
Soundex and Levenshtein Distance Demo

Soundex and Levenshtein Distance algorithms are very exhaustivey used in searching and spell check applications. Soundex is used to select words which 'SOUND LIKE' another word EX: Bryan and Brian Levenshtein Distance is the minimum number of steps required to transform one string to another. This algorithm can be effectively used to narrow down the number of possible matches for a given string. This can be useful in 'refining' your search results according to a threshold value.

6_2008-2009 #211262
Address Book 2.0

I got tired of loosing phone numbers & addresses. So instead of downloading or using a address book type of program from MS I decided to make my own where I could put what I wanted in there with no limits

6_2008-2009 #211312
FAST String Manipulation

When this module is compiled to native code, you can use the ReplaceString, InString, InStringRev, StrReverse, TrimStr, RTrimStr, LTrimStr, StringReplicate, JoinString and SplitString functions to be many times faster and much more memory effecient than their VB counterparts. Many are more functional as well. The replacestring function supports delimiters and prefix/postfix exclusions. All of these functions are fully unicode compliant. The performance gain becomes greater with extremely long strings, where most of the functions take less than 2% of the time and half the memory that the same call would take with intrinsic functions. By the way, you can all stop telling me that xbeat.net/vbspeed has faster code. They did have faster code than my first version, but not any of the other ones. See for yourself, the test specifications are on their website. :)

6_2008-2009 #211333
_Kyoko teach you string manipulation in 60 seconds_

This code shows almost all usefull function for string manipulation. Easy to understand, Easy to implement! Every line of source code with comment and 1 command button done all the functions in the text boxes.

6_2008-2009 #211394
Quick Levenshtein Edit Distance

Levenshtein edit distance is a measure of the similarity between two strings. Edit distance is the the minimum number of character deletions, insertions, substitutions, and transpositions required to transform string1 into string2. In essence, the function is used to perform a fuzzy or approximate string search. This is very handy for trying to find the "correct" string for one that has been entered incorrectly, mistyped, etc. The code has been optimized to find strings that are very similar. A "limit" parameter is provided so the function will quickly reject strings that contain more than k mismatches.

6_2008-2009 #211395
Database paging in ASP

I wanted to add paging code in my project.I've seen all other codes on the site but they are not at all worth for me. Now I've written a code which is very easy to understand and can be used by any student or professional in their projects.

6_2008-2009 #211412
Count words in a string with 2 lines of code

Have you been using the instr function, or 3rd party functions to find the word count of a block of text. Now you find it in ONLY 2 LINES OF CODE - NO API CALLS - NO MODULES / CLASSES / CONTROLS - PURE VB CODE

6_2008-2009 #211423
Inventory

To learn database in VB.net easy to add, edit, delete using OLED connection

6_2008-2009 #211464
Two Complete Parsing Functions. Easy to use.

Allows you to parse strings like those excel spread sheats. Example : Text1.Text = "Me,You,Us" MsgBox(Parse(Text1.Text, ",", 1)) Would return "Me"

6_2008-2009 #211472
Database-less Data Set

In old vb6 you could create a databaseless record set and save it as an xml file on disk, well now here is the .net version. It creates a dataset, adds a table, adds some columns and rows, then saves the schema and dataset to disk without ever touching a database. The xml produced is w3c standard. The app also shows how to open and add data and how to delete rows (and also using the xml schema). It isn't to complex and does have some comments in it to help. It is all native .net, no COM addins or other references.

6_2008-2009 #211496
Fast String Searching & CRC checksum

Fast String Searching & CRC checksum calculation in Visual Basic using pre compiled assembly code and memory mapped file concepts.This code is tested for binary comparison with ANSI code inputs only. UNICODE character input and strings having ligatures are not tested. It is up to the user to test the code with UNICODE/special character input and validate it. This is my first submission to PSC web site and I welcome your feedback and votes.

6_2008-2009 #211501
A starter project in ASP and ACCESS

**UPDATED** A starter project for new people to ASP and Access Databases, this script shows efficient INSERT, UPDATE, DELETE statements with CSS styling and a custom built paging script. Please vote - any feedback welcome.

6_2008-2009 #211546
Duplicate characters

This is quite a rare need, but here is a very fast solution for finding out whether there is a duplicate of any specific character within a string. Some people use InStr or InStrB as a solution for finding out a character duplicate, but the drawback is that InStr gets slow very fast if the first few characters are not duplicate characters. Also, if there are no duplicates then InStr loops the whole string the amount of length of the string, which can mean hundreds of times at worst case scenarios. The project provides two functions: HasDuplicates and HasDuplicatesM, the latter is class wrapped. The first one is a straightforward InStrB version. The second uses bitmasking in a Long array as well as safe array tricks to get Integer array access to the characters of the given string. Both functions return a character position of the first duplicate they find, however the results between the functions are always different, because InStrB version returns the first character while the safe array version returns the duplicate. InStrB version can be changed to work the same way. This code was requested at VBForums, I don't know why, but I made it anyway. The code should have enough comments for people to learn some advanced VB6 memory tricks.

6_2008-2009 #211548
Hex string & byte array conversions

These functions convert hex strings from/to byte arrays. A quick introduction to each: HexStringToBytes_A1: one of the most common ways to turn hex string to byte string using "&H" string conversion to a byte value. HexStringToBytes_A2: an optimized version of A1, grabs bigger values in one go and reduces amount of strings created. HexStringToBytes_A1: fills byte array using AscW & MidB$ HexStringToBytes_A2: same as before, but uses the passed string as a buffer instead just for comparison. Slower as creates more strings than A1. HexStringToBytes_C1: uses Windows CryptStringToBinary API. HexStringToBytes_S1: uses a lot of advanced VB6 tricks to achieve the greatest speed. API just can't compete with this one. HexStringToBytes_F1: uses advanced VB6 tricks like last one, but allows for any formatting in the passed hex string (such as spaces, line changes or anything else – simply looks for any valid hex pairs it can find). Shortly put: the C1 and F1 functions can parse "41 00 42 00 43 00", with formatting. The others only accept "410042004300", no formatting. Those hex strings would convert into a byte array: B(0) = 65 B(1) = 0 B(2) = 66 B(3) = 0 B(4) = 67 B(5) = 0 Or "ABC" as a string (Dim S As String: S = B). There are also functions working the other way around, BytesToHexString_C1 & BytesToHexString_F1. C1 is a version using CryptBinaryToString API while F1 is an optimized function that allows for custom output formatting! You can have any kind of formatting: none at all, just spaces between each hex pair, HTML, XML, C notation, JSON... use your imagination. Not only that, the F1 version is way faster than the C1 version with the exact same output! The following tricks are generally used for speed in the S1 and F1 functions: Safe arrays: VB6 stores arrays internally as safe arrays. The function creates "fake" Long and Integer arrays. Integer array for accessing the string data (1 character = 2 bytes = Integer) and a Long array for memory manipulation (PutMem4 & GetMem4 replacement) as well as saving the decoded hex string to the byte array. SysAllocStringByteLen: this API creates a BSTR and it does that very fast, especially if pointer is set to 0, in which case you get any free point from memory. That memory is not touched in any way except for setting up the minimal BSTR structure information (4 bytes string length & 2 bytes null terminator). This memory is not given to a string however! Instead it is given to the resulting Byte array. Why? It saves an unnecessary step of nullifying all the bytes that are reserved, and this always happens if you just ReDim an array. Long is the fastest datatype in VB6 in current processors. This is why a Long array is used to store the new bytes into the Byte array instead of just using it directly. Summa summarum: these functions should give good knowledge for anyone who wants to understand how memory can be handled so that you achieve better performance code in VB6. It isn't pretty though.

6_2008-2009 #211559
Insert Image into Sql Server

This Code will help the programmer to insert the image into a Sql Server Database through DataReader in VB.NET

6_2008-2009 #211600
Login/Register/Update

User can Login/Register and then update his/her profile. So Powerfull By Designing & Coding Wise At every step user is briefed that what;s going on and why. Easy to Learn for begginers. I asure after to read this code He/She will not be dependable of any one according to ASP Database

6_2008-2009 #211610
brute force algorithm

it's supposed to return the next password in a sequence of passwords, not random passwords, or a dictionary attack. it's designed to return case-insensitive alphanumeric passwords, but that can easily be changed, i can't help you do that, it's up to you

6_2008-2009 #211617
InBArr - now supports Unicode!

These functions perform a search like InStr within a byte array. Accessing byte arrays is much faster than accessing strings, but there aren't many tools provided in VB to handle the arrays. So here you have something: InBArr and InBArrRev, which can search byte arrays with a string keyword in both Unicode and ANSI modes. *** NOTE: you probably don't have a file named C:\hotfix.txt, so you have to edit Form_Load so you can try it. *** Votes welcome :)

6_2008-2009 #211640
Valid & fast TrimNull

While I think these TrimNull functions are a bit silly business, I guess they're mostly used due to lack of understanding of Windows API return values or of the file that is being processed, here you can find proper implementations of the LTrim & RTrim equivalents for NULL characters. Instead of InStr of any kind the string is processed as Integer array, without making a new copy of the string. This allows full control over the validation process and thus string is properly parsed from any NULLs at the end or beginning of a string. A test program is included for comparison which shows the bugs in other implementations. Also a bit fuzzy logic RTrimZZ is included: it is fast, but it is mostly dedicated to cases where you expect a buffer full of NULL, except for the actual data at the beginning of the string. The functions are long but fast.

Languages
Top Categories
Global Discovery