RE: [SPAM] RE: [Flashcoders] String Empowerment

2006-07-28 Thread Steven Sacks | BLITZ
Here's toTitleCase:

String.prototype.toTitleCase = function() {
var a = this.length;
if (a == 0) return "";
var c;
var w;
var s = "";
while (--a -(-1)) {
c = this.charCodeAt(a);
w = this.charAt(a - 1);
w = (w == " " || w == "\n" || w == "\r" || w == "\t" ||
a == 0);
if ((c > 64 && c < 91 && !w) || (c > 96 && c < 123 &&
w)) c = c ^ 32;
s = String.fromCharCode(c) + s;
}
return s;
};

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [SPAM] RE: [Flashcoders] String Empowerment

2006-07-28 Thread Mike
If you REALLY wanted to be fancy, you could have it accept an array of
words *not* to capitalize (unless they are the first word). For example:

var lowerCaseWords:Array = ["a", "an", "and", "of", "the"];

trace("a tale of two cities".toTitleCase(lowerCaseWords));

trace("THE PRINCE AND THE PAUPER".toTitleCase(lowerCaseWords));

// Output:
// A Tale of Two Cities
// The Prince and the Pauper
--
T. Michael Keesey

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Sacks | BLITZ
Sent: Friday, July 28, 2006 12:01 PM
To: Flashcoders mailing list
Subject: RE: [SPAM] RE: [Flashcoders] String Empowerment

> umm... Title Case as MS Word calls it...

Title Case in Word is different than capitalize.  Title Case capitalizes
every word in a string.  Capitalize only capitalizes the first character
of the string.  However, toTitleCase() would be a handy method.  I'll
code it.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [SPAM] RE: [Flashcoders] String Empowerment

2006-07-28 Thread Steven Sacks | BLITZ
> umm... Title Case as MS Word calls it...

Title Case in Word is different than capitalize.  Title Case capitalizes
every word in a string.  Capitalize only capitalizes the first character
of the string.  However, toTitleCase() would be a handy method.  I'll
code it.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [SPAM] RE: [Flashcoders] String Empowerment

2006-07-28 Thread Arul Prasad M L

Those convert the entire string, capitalize only uppercases the first

character and then lowercases the rest of the characters.


umm... Title Case as MS Word calls it...

~Arul Prasad

On 7/28/06, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote:


> Just a quick note on capitalize()
>
> String.toUpperCase() and String.toLowerCase() are part of ActionScript
1
> since Flash 5

Capitalize is different than toUpperCase and toLowerCase.  Those convert
the entire string, capitalize only uppercases the first character and
then lowercases the rest of the characters.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [SPAM] RE: [Flashcoders] String Empowerment

2006-07-28 Thread Steven Sacks | BLITZ
> Just a quick note on capitalize()
> 
> String.toUpperCase() and String.toLowerCase() are part of ActionScript
1
> since Flash 5

Capitalize is different than toUpperCase and toLowerCase.  Those convert
the entire string, capitalize only uppercases the first character and
then lowercases the rest of the characters.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [SPAM] RE: [Flashcoders] String Empowerment

2006-07-27 Thread Arul

Dear Steven Sacks,

I greatly appreciate the efforts. Long time back we started "ActionScript 
Standard Library" project in Sourceforge 
(http://sourceforge.net/projects/fasl) unfortunately it was discontinued  :(


On those days I wrote "Code.Flash MX: String.changeCase(Title || Sentence || 
Toggle)"

http://www.shockwave-india.com/blog/?archive=2002_11_01_archive.xml#83915217

Just a quick note on capitalize()

String.toUpperCase() and String.toLowerCase() are part of ActionScript 1 
since Flash 5


Regards,
Arul

Adobe Community Expert for Flash
http://www.shockwave-india.com/blog

__

toUpperCase (String.toUpperCase method)
public toUpperCase() : String

Returns a copy of the String object, with all lowercase characters converted 
to uppercase. The original value is unchanged.


Availability: ActionScript 1.0; Flash Player 5

Returns
String - A string.

Example
The following example creates a string with all lowercase characters and 
then creates a copy of that string using toUpperCase():


var lowerCase:String = "lorem ipsum dolor";
var upperCase:String = lowerCase.toUpperCase();
trace("lowerCase: " + lowerCase); // output: lowerCase: lorem ipsum dolor
trace("upperCase: " + upperCase); // output: upperCase: LOREM IPSUM DOLOR
An example is also found in the Strings.fla file in the ActionScript samples 
folder. The following list gives typical paths to this folder:


 a.. Windows: boot drive\Program Files\Macromedia\Flash 8\Samples and 
Tutorials\Samples\ActionScript
 b.. Macintosh: Macintosh HD/Applications/Macromedia Flash 8/Samples and 
Tutorials/Samples/ActionScript


__


- Original Message - 
From: "Steven Sacks | BLITZ" <[EMAIL PROTECTED]>

To: "Flashcoders mailing list" 
Sent: Friday, July 28, 2006 6:59 AM
Subject: [SPAM] RE: [Flashcoders] String Empowerment


Pseudocode examples of usage:

"hello".capitalize()  > "Hello"
"HELLO".capitalize()  > "Hello"
"123ABC".capitalize()  > "123abc"

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com