Please note the following code looks for a phase/value called (Phone: ) and once it's found in a string grabs all of the text to the left of it and returns the value:
I'm a lot more familiar with VBA than C# and was wondering if someone could help me with the code below that would be it's equivalent. MID function does a pretty good job of identifying text in a string if you give it a start value and LEFT I know C#'s equivalent is SubString... but if someone could convert the code to actual C# - it would be much appreciated.
I tried http://www.developerfusion.com/tools/convert/vb-to-csharp
and they are still stumped and have not returned a reply. I'm not trying to be guided to articles where I can read up on how to figure it out. I'm doing other programming stuff - this is just a little nugget that I'm stuck on and would ideally like some code to try and see if it's doing the same thing in Visual C# .NET.
Thank you in advance.
Public Function NoPhoneNumber(sValue as String)
Dim newvalue As String
Dim i as Integer
For i = 1 to len(sValue)
If len(sValue) > 8 Then
If mid(sValue, i, 9) = "(Phone: )" Then
newvalue = Left(sValue, i-9)
NoPhoneNumber = sValue