Results for "Category: String Manipulation"
The Richtextbox is a great tool for displaying text but it can be quite a task converting it's format for use on the web. This project is part of a Code Library application that I still use today. It has HTML saving options for publishing source code to web sites. It demonstrates manipulation of the Richtextbox control, string parsing routines and syntax highlighting. It will also format your code applying standard indentation, remove blank lines and truncate long lines neatly, making your code much more readable. You can then choose to save it back to disk as a VB file(retaining it's original header), an HTML file or as a rich text file(rtf). Like all code this old, I would do many of the functions quite differently nowadays, but there are still some handy techniques used here. I hope I didn't create too many bugs when I pulled it out of my Code Library app ! I have had quite a few emails of late enquiring as to when I'll upload some more submissions, so in response to those here is yet another Bobo submission !
Provides a tutorial and applications for implementing a database update strategy utilizing the DataSet, DataAdapter and SqlServer.
This sifts through all the text in a RTF file and changes the colour of html tags. It can be used ewither automatically or on the fly (as you type into the RTF box). It currently Chnages the colour of html tags (defined as anything between "") and html comments (""). Enjoy! Please mail me with suggestions
With this application you can test the connection to a SQL server prior to adjusting your connectionstring of your application. It can attemp to connect by socket and by connecting to the database. Instead of the IP adress a hostname can be used. If connection is possible then the connectionstring is copied to the clipboard Upgraded the code and made some new functionality Thanks for the feedback
' This easy code is design to open a text file, read a line at a time ' and take a set number of characters from the right hand side of each line ' This is a look at the basics of string and file manipulation ' I will also post a a program that will find a character and ' get the data left or right of it.
This is a .bas module that contains a few string manipulation functions I find useful in the real word. MakeProper replaces the limited proper case functions of VB with code that will format your string in title case, but not force mid-word capital letters to lower case. So "John Smith III" or "MacDonald" comes out correctly if typed are typed as "john smith III" or "macDonald". Initial letters of words are capitalized, but other letters are left as typed. DateWord takes a date and converts it to the phrasing used on legal documents, so 1/1/2000 would return "1st day of January, 2000." MailingLabelText accepts a number of inputs and returns a UDT that offers many variations on the name and address for use in creating mailing labels and other reports containing name and address data. The proper business ettiquette is observed in that the presence of an honorific like "Esquire or MD" eliminates the "Mr." or "Dr." Look for an update of this soon with more functions for string manipulation. The other functions are used by these three. LogError is pretty useful, too, come to think of it! I don't care about winning any prizes, I just wanted to contribute to a site that has helped me out so much. Your feedback is welcome all the same. PLEASE STILL RATE THIS SO I WILL KNOW WHAT YOU THINK!
Tutorial to teach about LTrim, RTrim, Trim, Left, Right, Mid, StrReverse, creating your own stringreverse function, Replace, InStr, and simple text encryption. 2500 Word approx and examples included
This code should explain the bubble sort ! Bubble sort is a sort algorithm that sortes string in very fast way. There are many sort algorithms but this is the best !
4 functions to handle command line options...example: yourprogy.exe -F, etc...one of them checks if a commandline option is in the command line....another one creates a commandline set with options...another one removes a specified option from the command line, and return the cmdline...(example: sometext -F, to sometext)...and the last one pulls out the text between 2 options in the commandline, and returns it...so -S blah -E would return just "blah"..can be very usefull...
Swap Variable1 for Variable2 using API, this is usefull for creating data processing programs with many stored variables. See Info below
The code will take a passed string and a delimiter and parse the string into a variant array for reading. Works very well with csv files, etc.
(PLEASE ALSO LOOK AT VERSION 2.10!)This code is an example of 13 different FX that can be easily implemented to a string. I have put them all together and put in quite a few notes explaining what each FX is doing. As you can see from the screenshot each effect can be modified in certain ways. I have written this so that you can have a better understanding of how computers work. I have tried to avoid using many of the built in functions. Each FX may not be the most efficient way of doing them, but I have done it this way to highlight the internal workings. All FX (apart from Rotate) work at a character at a time. Please send in any comments you may have - Good or Bad - so I can improve on it further. If you have any questions then email me. PLEASE RATE THIS. Thankyou.
This is an update of version 2.00 that I have done today. Because of some complaints of the speed I have added a speed option which includes "Fastest" (but this only works for options 8 to 12 as the others are so fast you cannot see them work!!) I have added a new FX called "Black Hole" where the text dissapears in to, or out of, the centre of the string. There are now 2 Bandits. The new 2nd one cycles through all the characters at the same time, compared to number 1 which did them one at a time. It should be noted that this is also an example of Framed Options; diabling and enabling them and discovering which have been selected by the user. Also in the Speed textbox you can only enter numbers (I got that off here, but hey!) Although I wrote this in VB5, I see no reason why it will not work in ANY of the other versions as it only uses basic commands like MID and MID$. (Although I am not sure when the MID command came in...) Please rate this!! and I would be interested in any comments you may have. Thanx!
This small and very simple sub will format the caption of a Label control if the text is too big to display in the control. The sub will trucate the text and append "..." to the end of the text (indicating to the user that they are not seeing the full text). VB automatically wordwraps the caption of a label if it is too big, however, this results in the caption being truncated only where there is a space. Also, you can see the top of the next line of the caption. Example Make and Model: Cadillac becomes: Make and Model: Cadillac Eldor... I find this extremely useful when I don't know the maximum length of the text the label will contain, or if I don't have enough screen real estate to make the Label big enough. Just pass a label to this sub for formatting.
This code provides an IsNull function like that used in SQL Server. This allows you to check if a variable contains null, and if so return a specific value. This can prevent you from having to write things like iif(not isnull(rst!FieldName), rst!FieldName, ""). For new programmers, especially those working with databases, you will quickly become aware that trying to access a database field that contains a null value often results in the dreaded error #94 - Invalid Use of Null, which means you constantly have to write code to trap for that possibility.
It typewrites any text you choose at any given speed
Simple function to validate string contents. Compares a given string to a list of illegal values and evaluates whether or not it contains any. Very fast and easy. Can also be used as a string search function with a little modification.
How would you like to process a form and insert its data into a database with only a couple of lines of code? With this tutorial I will show you how to process forms and insert data into databases with the least effort.
To move (indent) block of selected text as one, instead of one line at the time by using a TAB key. Just like you can select portion of your code in VB and move it as a block to the right. Use TAB to indent Use Shift+TAB to un-indent UPDATED ON 06/14/02: I've just added the UN-INDENT function as well :)
Quicksort which works by sorting string pointers only instead of the strings themselves. In particular for long strings around 1000 chars there is a 15 times improvement in speed, going up to 100 times for really long strings, and speed is almost indepent of string length; one million strings are sorted in under five seconds. For short strings below 10 chars or so speeds are more or less identical. The screenshot shows the compiled timing.