0
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?

VBAでStartsWith関数を実装したい

Posted at

VBAでStartsWith関数を実装したい場合は、Instr関数をうまく活用すればよいです。

Function StartsWith(str As String, prefix As String) As Boolean
    StartsWith = (InStr(str, prefix) = 1)
End Function

例:

Debug.Print StartsWith("Hello World!", "Hello")   '=> True
Debug.Print StartsWith("Hello World!", "Goodbye") '=> False

環境情報:

image.png

0
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
0
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?