Reputation: 37
I know that for files we can have *.txt and it will mean all the files with a .txt extension. I want to know if there is something like this for strings for example i have a string A constitutes from many spaces I don't know how many "spaces blabla spaces " but I'm sure there is blabla and I do this command if A="blabla" then I:=I+1; I will have I=0(because of the spaces). How can I resolve this problem ?
Upvotes: 1
Views: 104
Reputation: 121669
"Wildcards" for a filesystem are an example of "pattern matching".
For example, Windows allows simple patterns like ".txt" or ".???".
The general term for this kind of thing is "regular expressions", or "regex". I think you're really asking:
"Q: Does Ada support string regex"?
The answer appears to be "yes":
GNAT has two built-in packages for dealing with regular expressions. The first, called "Regexp", performs pattern matching using two different standards. First, it supports standard UNIX shell "file globbing" expressions as described by "man bash". Second, it supports BNF patterns as described in the Ada Reference Manual.'
Here are some good examples of the kind of string manipulation you can do with a regex library:
Upvotes: 1