Feedback

About Designerfoo and Me!

I am Manoj Sachwani, a webmaster, wannabe illustrator, designer, developer, amongst other things. I have over 14 years of experience, developing, designing and deploying websites. I am geeky, hairy and and I love what I do.

I stumbled & bought this domain - Designerfoo.com - because I thought it would be a "cool" domain to have, as time went on, I realized that I want to become - "Designerfoo" - and grow my knowledge in design, illustration, web design and web development.

I am webmaster, I design and develop websites with an edge. How may I help you?
Contact   -   @designerfoo   -   Facebook
Who is

Flex: Capitalize First Character of a String – CamelCase Function in Flex

Comment(s)

Flex 3 / AS3 Camel Case FunctionI was writing an Air App in Flex 3 and Action Script 3 and came across a situation where I needed to covert some strings to camel case dynamically before binding them to a control, I searched the API for any such function that would let me convert a string to camel case.


On not finding anything, I decided to write one of my own, and I thought I did share it with you guys. Hope this helps some one.

PS: I might have used more variables then required, but will clean it later, you can apply the logic to other scripting/programming languages too.


PPS: If you need help, let me know :)

//below function to create camelString
		private function camelCaseString(inputstr:String):String
		{
			var loopcount:int;
			var returnstr:String = "";
			var origStr:String;
			loopcount = inputstr.length;
			origStr = inputstr;
			while(loopcount>0)
			{
				var lastSpaceIndex:int = origStr.indexOf(" ",0);
				if(lastSpaceIndex<0)
				{
					lastSpaceIndex=origStr.length;
				}
				var tempstr:String = origStr.substring(0,lastSpaceIndex);
				var firstpartStr:String = tempstr.substr(0,1);
				var secondpartStr:String = tempstr.substr(1,tempstr.length);

		returnstr =                                           returnstr+firstpartStr.toUpperCase()   +secondpartStr.toLowerCase()+" ";

origStr = origStr.substring(lastSpaceIndex+1,origStr.length);

				loopcount = loopcount - 1;

			}

			return returnstr;
		}
		//function to return camel String ends here
Post Rating 3.00 out of 5


Subscrive via feedburner rss

Subscrive via feedburner email
2 Responses to “Flex: Capitalize First Character of a String – CamelCase Function in Flex”
Comment History Slider
    May 21, 2010 at 10:46 am
    Author: maramandan

    Hi,

    Thanks Mr. Manoj. I used your function and found it as very useful. I would like to say that it helped me a lot. I found one small glitch though, the function returned some trailing spaces which I trim()med.

    :)

    maramandan

      May 22, 2010 at 9:42 am
      Author: Designerfoo

      Hi Maramandan,

      Your welcome! Glad you found it useful! yeah, I forgot the trim :)



Leave a reply :)

Name:

(required)

Mail (will not be published):

(required)

Website:

Comment:


Subscribe

Deliverables

  • Website design/interface layout
  • CMS Theme-ing
  • Website/webapp/RIA Development
  • Website redesign
  • Webmaster services
  • Consultations on marketing/branding/etc over Coffee/beer/lunch/dinner

My Value Proposition

  • Fast turn around times.
  • Free consultations on marketing and branding
  • Affordable services
  • Around the clock support.
  • An experience of over 14 years with providing these services.

My services for barter.

  • If you think you might have something that I would use/want, I am ready to provide my services for $1.00 and a barter!

Friends

A thanks of gratitude to these guys. They are just plain awesome!

Eventify – Simple Events

NextGEN Resize Wordpress Plugin

Categories

Recent Posts

Looking for something?

Thanks to Subscribers

Feedburner : 24


Twitter : 2250

Thank you for taking the time out.

Your Email (required)

Your Email (required)

Your Feedback

What to do you think of Eventify - Simple Events?

View Results

Loading ... Loading ...

What do you think about the NextGEN Resize Plugin?

View Results

Loading ... Loading ...

What do you think about the site design/UI/IA?

View Results

Loading ... Loading ...

  X Close Feedback.