Improving Function - Using Stringbuilder To Replace My Strings?
Jun 21, 2009
vb.net
'strSearch = textBox.Text, columns 2 to 10 are the optional columns you want to search to. Function WhereQuery(ByVal strSearch As String, ByVal column1 As String, Optional ByVal column2 As String = "", Optional ByVal column3 As String = "", Optional ByVal column4 As String = "", Optional ByVal column5 As String = "", Optional ByVal column6 As String = "", Optional ByVal column7 As String = "",[code]..
sample output:
im also thinking on using stringbuilder to replace my strings.
View 1 Replies
ADVERTISEMENT
Jul 1, 2011
Would the world of strings be better if stringbuilder had IndexOf?
View 2 Replies
Apr 8, 2011
I got this problem, is there way to use "replace" function to replace multiple strings of same list?
Like;
Dim rList As List(Of String)
rList.Add("A")
rList.Add("B")
[Code]....
View 3 Replies
Nov 3, 2010
How do I refactor the method GetInvoiceNumbers to replace the SQL String concatenation with the StringBuilder class? Here is my code:
Private Function GetInvoiceNumbers() As System.Collections.Generic.List(Of Invoice) Implements InvoiceService.GetInvoiceNumbers
Dim invoiceList As New List(Of Invoice)
[Code].....
View 3 Replies
Jul 9, 2010
Is it from a sight of resources reasonable to use a StringBuilder already to concat two strings or is there a minimum concatenation operations that makes the StringBuilder efficient?
View 4 Replies
Mar 2, 2012
I'm hoping to improve the performance of the below as well as return the GUID of each user.
I've converted and modified the code found here for searching through groups recursively to get all the members and their details and adding them to a class collection. However I also need to capture the user's managers details so I'm calling the AD twice for each user. This doesn't seem efficient as many of the users will have the same manager. It would seem logical to get the distinct manager details from the collection class and call only these, then replace them wherever they occur in the collection.
I'd also like to be able to get the user's GUID, I've tried accessing it directly as a property of the collection, but it doesn't return anything.
I'm using vs2005 and .Net 2.0
Public Class ADCLass
''' <summary>
''' Calls recursive function to return users in group
[Code]....
View 1 Replies
Jul 7, 2011
I am using replace function to replace a character in the file
sw.WriteLine(Regex.Replace(strLine, "\", Chr(13)))
This code is working fine, but now I want to replace two times and I want to use the replace function twice. Something like this, but it is not working . Can anyone tell me how to use Replace function multiple times?
sw.WriteLine(Regex.Replace(strLine, "\", Chr(13)).Replace(strLine, Chr(13), ""))
View 2 Replies
Jul 19, 2011
I need to find several hrefs in html like this:
<table>
<tr><td><a href="url1">link1</a></td>
<td><a href="url2"><img src="image.jpg" /></a></td>
</tr>
</table>
Once found I need to add (replace) to each href something like this:
?ID=1
therefore the html should turn out like this:
<table>
<tr><td><a href="url1?ID=1">link1</a></td>
<td><a href="url2?ID=1"><img src="image.jpg" /></a></td>
</tr>
</table>
View 1 Replies
Jul 15, 2010
I'm creating a method to replace variables in strings, I'm going to share an example of how I'm replacing values and can see short falls in how what I'm doing. Here's a stripped down example of what I'm doing. It replaces a variable with the date specified, so %today(-1) would give me yesterday, %today(2) would give me two days from now.
[Code]...
View 3 Replies
Feb 13, 2012
So I have software to replace string with string, it's cool but I need code which would replace any given character (for example a) with all strings from textbox.
Here is example:
Character to change: a-> X
List of words which should not be touched: "car"
[Code]...
View 2 Replies
Apr 27, 2010
The code below replaces if it finds a given string from the list of contractions with its equivelant from the list of word-contractions. E.g., if it finds 'll it will replace it with Will. The code words but whtn it comes to let's it will replace it with let is.
'remove panctuation and contractions first
Dim contractions As List(Of String) = New List(Of String)(New String() _
{"'ll", "'re", "'ve", "'m", "'d", "'s", "n't", "won't", "lets", "let's", "ikon of elkomenos", "ikon of crucifixion", "ikon of crist elkomenos", "Part A", "Part B", "renaissance style", "hagios nikolaos", "full wall fortification"})
[code]....
View 3 Replies
Feb 5, 2011
I have an string in a textfile that looks like this:or something similar. The T's represent true and the F's represent false. I wrote each letter to an array, like so:
[Code]...
View 14 Replies
Mar 9, 2012
I'm populating a datagridview from a database where all the data has had apostrophes and quotation marks stripped out and replaced with ASCII values; now I want to replace them back. Since the user can perform a variety of queries that are all displayed in the same table, any column might contain text fields.
View 9 Replies
May 19, 2012
First it might sound like an ordinary task but keep reading it isn't. I can't figure out how to find a phrase in a text file, and replace it with something else. Tried lots of things but always ending up with empty hands.
Suppose there's a text file in this order:
valueabc=6000.0000
valuettt=200.0000
valuexyz=7000.0000
I want to;
1) Find the phrase (e.g. valueabc) by scanning the whole text,
2) Replace the number that starts after "=" and ends before ".", namely "6000" in the middle with any number value i want.
I don't need the parts before "=" and after ".", only the number in the middle.
View 10 Replies
Sep 26, 2011
In c programming language,
I can do
printf("%d
", value);
But in c#, how can I do it? For example string is "Good %s everybody"
I want to replace %s with the variable. Are there any solution except str.Replace("%s","good morning");
View 1 Replies
Apr 1, 2010
Their is a alfanumeric value of any lenght (string) and i want to replace its all characters with 'X' except right four characters.[code]I have created a function but got stuck:[code]please tell me a better fuction to perform such a operation
View 4 Replies
Jun 23, 2009
I have a text file like this
4.5 28 Red (T1 ) [1 12.86 53.8] 229111 -28275 198452 -1309 | 11.0 28 Red (2 13.10 04.0) [T1 ] 130611 2948 229111 28275
1.5 28 Blue (T2 ) [1 07.06 59.1] 191611 51225 190456 39339 |
[code].....
View 2 Replies
Mar 20, 2009
It works for the First Replace but not for the Earnings Replace, I want to check a label and if its have a First Character E I need to be replace with
[Code]...
View 1 Replies
Feb 3, 2010
I am a long time VB6 programmer and am just starting VB 2008.I am learning VB 2008 by converting an existing VB6 program.I have a section of code: [code]frmInstall has an operator input.When the input is complete, gbolWait4Install is changed to Fales.I don't want the program to move on until the operator input is complete.What is a clean way of doing this in VB 2008?
View 1 Replies
Dec 13, 2009
I have a replace function in text files where it replaces all the vbTab with ';' betweens the columns. Sometimes it may be that some fields have more vbTabs and then there is lot of empty fields.How do I via a smart and simple way to replace all vbTab with ';'. That is, the field has more than one vbTab will they just be replaced by a
vb.net
Dim Fs As FileStream = New FileStream(my_filename, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)
[code].....
View 5 Replies
Nov 5, 2010
i created a DatagridViewNumericUpDownColumn but i got error message Cannot access a disposed object. Object name: 'NumericUpDown'when i closed and reopen the form. It shown You are not authorized to perform this action.how can i get access to view this thread?
View 4 Replies
Sep 29, 2009
Can somebody give me hint how to use function Asc() in vb to reverse strings?
View 3 Replies
Jun 20, 2012
Basically, I'm trying to do some string manipulation to edit directories. I found some code to try and edit the directories, but when I use it it doesn't recognise 'right' as being a function and only recognises it as a right property, thus producing an error.
I was wondering if there's something I haven't imported or if perhaps 'right' is an obsolete function that was used in VB6 but replaced with something. The code I have is as follows:
[Code]...
View 2 Replies
May 15, 2009
I have a VB .NET String. How can I search that string for a character string and replace it with another string?
For example:
Dim rValue As
String = sproc.ExecuteScalar()
' rValue now has the XML string <indracio fire height=23, width - 6>
/* This is the string that I want to search. Replace the words "indracio fire" with the word "lucion time"
How can I search this string for the words "indracio fire" , and replace with the word "lucion time" ?
View 1 Replies
May 10, 2011
I'm using a recommended character replace regex I got from this forum, however it is not fully working in deleting unspecified characters
Original String:acAc10[]() _~!#$%^'&*()+-[]`"
Actual Result:acAc10()_#$%'&*()+-"
Desired Result:acAc10() _!'-"
[Code].....
View 1 Replies
Apr 18, 2012
I don't use VB.Net very much, still mostly do VB6, but I am doing this project in .Net. I have a huge string of data, 168 Mb that I stream in from a file to a string variable. Then I have to perform a number of replacements on it before using the data to compile statistics. Because of the nature of the data, I can't break this up into smaller strings.
The problem is that I get a system out of memory error after a few replacements.
I've used both Replace(x,y,z) and X.Replace(y,z). The second one gets a little farther in the code before it crashes, but they both crash.
When I run it in the IDE, the IDE is using about 130 Mb of RAM, the Exe of the app is running about 350 Mb, and one svchost.exe runs about 300 Mb
Other than that there are no major RAM uses going on. The PC has an i7 980x cpu with 12 GB of RAM.
View 2 Replies
Aug 4, 2010
I am creating an text encryption/decryption for my friend and I to use on facebook, because his parents read his messages. I made everything correctly, but when I hit the buttons they don't do anything.
VB
Dim strString As String
Dim strString2 As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strString As String
[code]....
View 1 Replies
Oct 5, 2011
Update: I didn't make it clear but I meant this to be a question about where/how I would use a function to return a list of strings when I'm trying to just work with classes.I have a class called Account.
I have data access class called AccountDAO.I have various functions that return lists of objects like GetAllAccounts, GetAccountByID etc.I want to populate a drop down list with just the account names and nothing else. It's proving rather slow when using lists of objects and databinding them to the dropdownlist.
I feel like I should be using a simple "Select Account_Name From blah" type statement and returning a list of strings but I don't know how to work this into my class and data access class.
View 4 Replies
Oct 16, 2009
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 Replies
May 21, 2010
I am trying to perform calculations on Regex substrings. I would like to do something like (see $2)
lblResult.Text = reg_exp.Replace(txtInput.Text, "$1" & "$2" * 0.039 & "$3" & "$4" & "$5")
I can only do this like:
For Each RxMatch In reg_exp.Matches(Me.txtInput.Text)
Me.lblResult.Text = Me.lblResult.Text & _
RxMatch.Groups.Item(1).ToString & _
Math.Round(CDbl(RxMatch.Groups.Item(2).ToString) * 0.03937, 4) & _
[code]....
View 3 Replies