4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

文字列関連の関数、コマンド

Last updated at Posted at 2023-02-10

はじめに

UipathでのRPA開発の中で、よく使うけどぱっと出てこないVB.NET系の文字列操作をまとめました。
(1)文字列の位置特定
(2)文字列の抜き出し
(3)文字列分割
(4)文字列から数値だけを抽出
(5)文字列比較/大文字小文字区別なし

(1)文字列の位置特定

IndexOf("xxx")

image.png

(2)文字列の抜き出し

Substring(位置,文字数)

image.png

(3)文字列分割

Split("文字列","区切り文字")(n) →区切ったn-1個目の要素を取得

image.png

(4)文字列から数値だけを抽出

System.Text.RegularExpressions.Regex.Replace("文字列", "[^0-9]", "")

image.png
image.png

(5)文字列比較/大文字小文字区別なし

文字列①.Equals(文字列②,StringComparison.CurrentCultureIgnoreCase)

↓引数なしだと大文字小文字を区別して判断

image.png
image.png

↓引数「StringComparison.CurrentCultureIgnoreCase」ありだと大文字小文字を区別しないで判断

image.png
image.png

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?