Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/String-matching/DCL/string-matching.dcl
Normal file
24
Task/String-matching/DCL/string-matching.dcl
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
$ first_string = p1
|
||||
$ length_of_first_string = f$length( first_string )
|
||||
$ second_string = p2
|
||||
$ length_of_second_string = f$length( second_string )
|
||||
$ offset = f$locate( second_string, first_string )
|
||||
$ if offset .eq. 0
|
||||
$ then
|
||||
$ write sys$output "first string starts with second string"
|
||||
$ else
|
||||
$ write sys$output "first string does not start with second string"
|
||||
$ endif
|
||||
$ if offset .ne. length_of_first_string
|
||||
$ then
|
||||
$ write sys$output "first string contains the second string at location ", offset
|
||||
$ else
|
||||
$ write sys$output "first string does not contain the second string at any location"
|
||||
$ endif
|
||||
$ temp = f$extract( length_of_first_string - length_of_second_string, length_of_second_string, first_string )
|
||||
$ if second_string .eqs. temp
|
||||
$ then
|
||||
$ write sys$output "first string ends with the second string"
|
||||
$ else
|
||||
$ write sys$output "first string does not end with the second string"
|
||||
$ endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue