Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Possessive Problem

Status
Not open for further replies.

sjpatrick

Programmer
Sep 4, 2001
54
US
I have a string, a person's name.

If the name is, say, (James), I make it possessive by appending an apostrophe ('); if it's (Bob), I also include an (s), i.e. ('s).

I haven't been able to find a way to check the supplied string to see if it ends with an (s) so I can determine what I need to do with said string.

The bluebook isn't helpful.

Any help would be much appreciated. Thanks in advance.

Steve


<d3v310p3r/>
 
Given the string is assigned to a variable, say /Str, then:

Str Str length 1 sub 1 getinterval (s) eq
{
/Str Str (') cat def
}
{
/Str Str ('s) cat def
} ifelse

The code above implies that a catenation operator i.e.
S1 S2 cat -> S1S2
is already defined.

Hope that this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top