Many thanks to our Patrons who cover ~2/3 of our hosting bill. Please join them if you can.

Test:Substring

From Wikispooks
Jump to navigation Jump to search

2019-07-05

The MediaWiki upgrade has obsoleted the old strlen functions. The modern way is to use the String module. i.e:

{{#invoke:String|sub|ABCDEFGHIJKLMNOPQRSTUVWXYZ||-1}}

ABCDEFGHIJKLMNOPQRSTUVWXYZ

{{#invoke:String|sub|ABCDEFGHIJKLMNOPQRSTUVWXYZ|-1|}}

Z

{{#invoke:String|sub|ABCDEFGHIJKLMNOPQRSTUVWXYZ|3|5}}

CDE

{{#invoke:String|len|ABCDEFGHIJKLMNOPQRSTUVWXYZ}}

26