in reply to Re^2: substr function
in thread substr function
Write an ordinary Perl program that filters the text, then measures its length using the built-in substr function.
You're trying to solve an everyday text processing problem in a very peculiar and unconventional way. Writing a custom substr function to measure a particular kind of "string" is like inventing a bathroom scale that knows when your hair is wet and you haven't removed your shoes, yet accurately measures your bone-dry, barefoot weight.
I'm curious: Do you want to measure the lengths of the strings in bytes, in encoded characters (Unicode code points), or in real-world characters (Unicode extended grapheme clusters)?
CLARIFICATION: I admit I sort of conflated substr and length in this post. My excuse is that I was fixated on the words "count" and "one character" in tej's restatement of his Y problem:
Suppose i have string that contains tags like "<bold>" it should not count this tag. If string has something like "<194>" I want substr to consider it as one character.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: substr function
by ikegami (Patriarch) on Jan 13, 2011 at 16:56 UTC | |
by Jim (Curate) on Jan 13, 2011 at 17:11 UTC | |
by ikegami (Patriarch) on Jan 13, 2011 at 17:30 UTC | |
by Jim (Curate) on Jan 13, 2011 at 17:48 UTC |