Ticket #13 (closed new feature: implemented)

Opened 2 months ago

Last modified 2 months ago

capstr(<string>,[<arg>])

Reported by: Xandar Owned by: loki
Priority: low Milestone: 3.9.1 alpha 1
Component: rhostmush Version: 3.9.1 alpha
Severity: none Keywords:
Cc:

Description

Current functionality:

capstr(this is a test)

returns

This is a test

Proposed functionality:

capstr(this is a test)

returns

This is a test

capstr(this is a test,1)

returns

This Is A Test

Change History

Changed 2 months ago by loki

  • status changed from new to accepted
  • version set to 3.9.1 alpha
  • milestone set to 3.9.1 alpha 1

Changed 2 months ago by loki

An alternative could be a caplist() function which allows for the same functionality as Xandar has proposed. This could allow for caplist(<list>[,<delim>[,<osep>]]).

Changed 2 months ago by Ashen-Shugar

I'd suggest caplist(<list>,[,<delim>[,<osep>,[<key>]]])

Where 'key' can specify to lowercase the entire string before capping it or optionally using 'Title' parsing which means that common words like 'a', 'the', 'this', 'them', etc won't be capitalized.

Changed 2 months ago by loki

  • owner set to loki
  • status changed from accepted to assigned

Changed 2 months ago by loki

Proposed helpfile:

& CAPLIST()

Function: caplist(<list>[<delim>[,<osep>[,<key>]]])

Returns <list> with the first character of each word capitalized. You may specify an optional <delim> as a delimiter for the list input, otherwise the default of space will be used. You may also specify an optional <osep> as a separator for the list that is returned.

Additionally, an optional <key> may be specified which alters the behavior of the function slightly. The key must be one of the following characters:

  • T: Performs capitalization based on English titular grammar rules

(thus words such as 'a', 'an', or 'the' will not be capitalized). This also assumes 'L'. The first letter in the string is always capitalized.

  • L: Reduces the entire list to lower case before capitalization is

performed.

  • N: Performs capitalization naturally, and does nto affect any other

characters in the list (default).

Example:

> say caplist(the mAn in thE mOon). You say "The MAn In ThE MOon."

> say caplist(the mAn in thE mOon|,L). You say "The|Man|In|The|Moon."

> say caplist(the mAn in thE mOon,T). You say "The Man in the Moon."

Changed 2 months ago by loki

Take two on the helpfile; this time with pre tags to try and get around the wiki issues!

& CAPLIST()
  Function: caplist(<list>[<delim>[,<osep>[,<key>]]])

  Returns <list> with the first character of each word capitalized.  You may
  specify an optional <delim> as a delimiter for the list input, otherwise the
  default of space will be used.  You may also specify an optional <osep>
  as a separator for the list that is returned.

  Additionally, an optional <key> may be specified which alters the behavior
  of the function slightly.  The key must be one of the following characters:
    - T:    Performs capitalization based on English titular grammar rules
            (thus words such as 'a', 'an', or 'the' will not be capitalized).
            This also assumes 'L'. The first letter in the string is always
            capitalized.
    - L:    Reduces the entire list to lower case before capitalization is
            performed.
    - N:    Performs capitalization naturally, and does nto affect any other
            characters in the list (default).

  Example:
    > say caplist(the mAn in thE mOon).
    You say "The MAn In ThE MOon."

    > say caplist(the mAn in thE mOon,,|,L).
    You say "The|Man|In|The|Moon."

    > say caplist(the mAn in thE mOon,,,T).
    You say "The Man in the Moon."

Changed 2 months ago by loki

  • status changed from assigned to closed
  • resolution set to implemented

Initial checkin is complete as of r260. Some minor changes to the helpfile, and 'T' mode is not yet in.

Still needs some testing. 'T' mode will be made into a separate helpfile.

Note: See TracTickets for help on using tickets.