Question about char() arrays in parameters

  • Thread starter Thread starter Raterus
  • Start date Start date
R

Raterus

Hi, what is an easy way to send char() arrays as parameters, using option
strict.

For example, I'm using the String's TrimEnd function, which takes in a char
array as a parameter. I'm love to do something like this

myString = myString.TrimEnd(".")

but I like to keep "Option Strict" set, so I'll get a nice warning. Is
there anyway to denote this as a character array, without going through the
mess of having to create a character array for just one character?

Thanks!
--Michael
 
Found an example like this

myString = myString.TrimEnd("."c) <-- New syntax to me, anyone have a site
I can look at that will explain that more??
 
* "Raterus said:
Hi, what is an easy way to send char() arrays as parameters, using option
strict.

For example, I'm using the String's TrimEnd function, which takes in a char
array as a parameter. I'm love to do something like this

myString = myString.TrimEnd(".")

but I like to keep "Option Strict" set, so I'll get a nice warning. Is
there anyway to denote this as a character array, without going through the
mess of having to create a character array for just one character?

Use 's.TrimEnd(New Char() {"."c})' instead.
 
Raterus,

it just defines the character as a simple character (one only), not as a
string.

Klaus
 
Hi, what is an easy way to send char() arrays as parameters, using option
strict.

For example, I'm using the String's TrimEnd function, which takes in a char
array as a parameter. I'm love to do something like this

myString = myString.TrimEnd(".")

but I like to keep "Option Strict" set, so I'll get a nice warning. Is
there anyway to denote this as a character array, without going through the
mess of having to create a character array for just one character?

Thanks!
--Michael

In addition to the other suggestions :)

mySTring = mySTring.TrimEnd(".".ToCharArray())
 
Back
Top