Check For Only Digits In String?
Jul 30, 2010I want to run a check on a String right before I append it to a StringBuilder to make sure only numeric characters are in the string. What's a simple way to do that?
View 7 RepliesI want to run a check on a String right before I append it to a StringBuilder to make sure only numeric characters are in the string. What's a simple way to do that?
View 7 RepliesIm trying to get my code to check that my textbox has 16 digits in it so that it can then validate the number entered. Here is the doe i have so far: [code]
View 3 RepliesFunction to read consective 5 same letter or digits from the String given.Eg: String get = "vennnnnkat";
View 5 RepliesI need a regular expression that I can use in VBScript and .NET that will return only the numbers that are found in a string.
For Example any of the following "strings" should return only 1231231234
123 123 1234
(123) 123-1234
123-123-1234
[Code]....
I am new to VB (and coding in general) and I'm wanting to make a check digit generator. To do this I need to take the a user text input and split it into individual digits so that I can then calculate the check digit.
View 2 RepliesDim Timing1, Timing2 As DateTime
Timing1 = DateTime.Now
MyCode
[code].....
For some reason I can't figure this out. Here's my code. colorTextbox.Text =Format(Hex(ColorBox.Color.G), "00")What I want it to do is format the Green Hex number to be "00" instead of just "0" when the color is something like blackhis has proven to be very stressful and this Format command makes no sense to me anymore (worked differently in 2005).For one, whatever I put in the quotes ("00") is what comes out in the text box. Butaccording to the command parameters, "00" should be the format, not the actual text! So then I tried any string format I could think of (## etc.) along with switching the order and I STILL can't figure this out.
View 16 RepliesHow to extract digits from the beginning of a string?
1234A - should output: 1234
123AB - should output 123
12ABC - should output 12
1ABCD - should output 1
This is an example of the text I want to modify:
0110
0001
0001
1000
[Code]....
Here, I want to replace two-line digits in bold(0110 0001) with a different sequence as the program scans the text line by line. But two things complicate the task:
1. the comma lines should be ignored, but
2. they also should stay intact after changing the digits.
I'm trying to match a string to see if it matches exactly this:####-####, it has to be 4 digits followed by a hyphen followed by 4 more digits. Right now I have this pattern: "d{4}-d{4}" but it's allowing 5 digits in either (or both) instead of strictly 4 per group. Here's an example of what it should allow:
1999-2000
2003-2007
2009-2010
and here's what my pattern is allowing but should not be allowing:
20081-2009
2009-20101
12345-12345
12345-1234-1234
I have 10 labels with 10 numbers and i want theses numbers to compare with other 10 labels with different numbers and when they found that second pair of labels are not equal with the first to show me in a new label where is the fault and in another new label the sum of the mistakes
View 3 RepliesI got an app, which receives data via a R232 port, convert it to a string and on the other side I got a database, where the strings are saved. How can I find a way to compare the string with all strings in one database column and get back the another stringform the same row in this database. I never programmed a database
View 1 RepliesWe know that VB string start and end with double quotes " "
So we have to use "" if we want " in VB string.
I wonder if there is a regular expression pattern which will match VB string?.
I want to check if a string is utf-8 encoded.
UPDATE: So, the problem is: I have a php webservice. This webservice has a method that receives a string. I'm trying to pass a VB.NET JSON string to this webservice. json_decode always returns an error, saying that the string is not utf-8. If I pass the string and convert it using PHP utf8_encode, the accents get wrong!
I want to only show the last four digits of a Social security number after they leave the textbox. Does AJax have a tool for this that I am not aware of? How can i do this? I want to replace the digits with '*'. I'm working in .NET. Ajax is also accessible.
View 2 RepliesI have a textbox called TxtProNo - this should be ONLY 10 digits maximum. After 10 digits have been typed, the user can't enter any more digits, how can I achieve this...
View 3 Replieshey ppl i have a simple one today. How can i get the year to come up only as the 2 digits . Ex
2009 but i only want 09
i have this
DatePart(DateInterval.Year, Date.Today) but i was looking for a trim that will do this any ideas
actually we have given an assignment that find the LCM of two digits in VB.netbut i m not getting the logic how to code this...e-g... we have two digits... 10 and 20
2| 10, 20
2| 5 , 10
5| 5, 5
[code].....
Excuse me if this question already have been answered somewhere else but I really need to know.I need the code to take certain digits out of an intiger, for example:I have the integer 3002010 I want to put the 2 last digits in another integer.Then I want to put the 20 in another integer.After that I take the first digits which comes before those.
Another example:
I have 2993064 In integer one it should be 64 In integer two it should be 30 In integer three it should be 299
I am struggling to check for a " in a string in vb.net. Could anybody suggest a way to look for " in string as we do in c# using " " "
I have tried with, " and "" but of no use.
If partnerItem.Contains("*") Or partnerItem.Contains(""") Then
isBad = True
reportError(i + 1, colDetails(0), colDetails(1), "Field cannot contain " & PARTNER_ITEM_INVALID_CHARACTERS & " characters.")
The following code checks a strings if it contains particular words and if yes it removes them. The problem is that it also removes characters that it shouldn't. For example: If user_input3 contains a word like lo(ok) it would remove the last characters ok. How can i modify the code to remove whole words only?
[Code]...
I have a string, lets say "((HRARNT*50)/100) + ((HRA*10)/100)"
And, i have value for HRA, HRARNT in a DGV and i want to replace it with its value to get "((5000*50)/100) + ((3500*10)/100)"
But, problem arises when it replace HRARNT with "3500RNT" as it got HRA value in DGV.
Now, i want it to first check if its prefixed or suffixed with +,-,*,/,),( then only it should replace with its subsequent value from DGV.
Though, first i tried placing HRA,HRARNT in [] and then replace, which worked fine, but users don't want to add [].
How to implement above logic?
I got a list of strings. And I want to check for every string in there. Sometimes, a string can have the suffix _anim(X) where X is an integer. If such string has that kind of suffix, I need to check for all other strings that have the same "base" (the base being the part without suffix) and finally group such strings and send them to my function.[code]...
View 1 RepliesI'm reading data in from a comma-separated text file and storing the data in an array for later use. Some of the values are to remain as strings, and I need to convert some to integers, for which I was trying to use, for example, integer.parse(ar(0)).
My problem is that the string values are randomly distributed through the text file, so I need to be able to test whether the string can be converted at all before doing the conversion.
I am just a beginner in VB programming. What if I want to check if a certain subtext is present in a string? For example, what do I code if I want to check if the word "hello" is present in a particular string or not?
View 3 Repliesany method that can check for specific value of a string whether it exists in the string and if it does then that whole string will be captured with that specific text.
View 15 RepliesDim number As String = "07747(a)" If number.... Then endif I want to be able to check inside the string to see if it only has number, if it does only contain numbers then run whatever is inside the if statment? What check do i use to check if the string only contains numeric and no alpha ot () etc ..? What i am trying to check for is mobile numbers, so 077 234 211 should be accepted, but other alphas should not be
View 3 RepliesHow do you check to see if a string is a numberic value?
View 7 RepliesI'm trying to create an address bar, much like Google chrome's, where you can enter a url and it will navigate to it or enter just text and it will search Google etc.
I've been at this for a while Googling away, but I can't find a reasonable solution. I know I could look for things like: 'http' etc, but these come in an almost unlimited number of variations. I could also created a webbrequest to test its existence, but I think this could cause an unwanted slow down in the programs operations.
I have a bit of code that looks like this:
Code:
If PageHTML.Contains("hey") Then
If PageHTML.Contains("beer") Then
If PageHTML.Contains("moose") Then
[Code].....