How I can split this passage?
Color [A=255, R=100, G=200, B=50]
and I get 255,100,200 and 50 to one array or variable?
Printable View
How I can split this passage?
Color [A=255, R=100, G=200, B=50]
and I get 255,100,200 and 50 to one array or variable?
You mean parse out the argb values of a Color?
VB Code:
Dim oColor1 As System.Drawing.Color = Color.Red Dim iA As Integer Dim iR As Integer Dim iG As Integer Dim iB As Integer iA = oColor1.A iR = oColor1.R iG = oColor1.G iB = oColor1.B
very thanks
but if I want split "Color [A=255, R=100, G=200, B=50]"
and get numbers from that, I must do?!
You have that as a string? You are probably getting that from the Color.FromArgb?
that's an example
for this string "my cost = 30530$"
how I can discrete 30530 from another string?
I don't know much about them but you might be able to use Regular Expresions (RegEx) to find numbers inside a string. But if they need to be identified as in your first example, things get complicated.
There is no 'magic' function to do this, for each situation you will have to write a specific function. String parsing is also very error-prone because it is hard to think of all the variations you might encounter.
You can use .SubString and other string functions to parse the number.
VB Code:
Dim str As String = "my cost = 30530$" Dim iNum As Integer = str.IndexOf("=", 0) str = str.Substring(iNum + 1) str = str.Substring(0, str.Length - 1) MessageBox.Show(str) '30530
very thanks
:) But note that the format of the string needs to remain with the numbers after the "=" sign and the last character always being necessary to be trimmed off. ;)