<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>中文Flex例子 &#187; 字符串</title>
	<atom:link href="http://blog.minidx.com/tag/%e5%ad%97%e7%ac%a6%e4%b8%b2/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.minidx.com</link>
	<description>中文Adobe Flex例子,Flex实例教程,RIA资源,全文检索技术,算法和数据结构</description>
	<lastBuildDate>Thu, 31 Mar 2011 03:22:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MFC/C++/C中字符类型CString, int, string, char*之间的转换</title>
		<link>http://blog.minidx.com/2009/03/03/2209.html</link>
		<comments>http://blog.minidx.com/2009/03/03/2209.html#comments</comments>
		<pubDate>Mon, 02 Mar 2009 16:25:03 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[程序开发相关]]></category>
		<category><![CDATA[字符串]]></category>
		<category><![CDATA[字符类型]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/?p=2209</guid>
		<description><![CDATA[项目中经常用到各种不同的语言的朋友们应该会比较有这样的体会：一种开发语言用了比较长的时间，突然间转到另外一种语言的话，不管是数据类型或者语法结构，多多少少都会有那么一点不适应。哪怕MFC中的类型与标准C++也是一样的。下面是MFC/C++/C中字符类型CString, int, string, char*之间的转换的说明与举例，经常用的东西，相信对于用C/C++的朋友，还是比较有用的。








1 CString,int,string,char*之间的转换&#160; 
string 转 CString&#160; 
CString.format(&#34;%s&#34;, string.c_str());&#160; 
&#160;
char 转 CString&#160; 
CString.format(&#34;%s&#34;, char*);&#160; 
&#160;
char 转 string&#160; 
string&#160;s(char *);&#160; 
&#160;
string 转 char *&#160; 
char *p = string.c_str();&#160; 
&#160;
&#160;//&#160; CString转std::string
&#160;CString str = dlg.GetPathName();
&#160;setlocale(LC_ALL, &#34;chs&#34;);
&#160;char *p = new char[256];
&#160;wcstombs( p, str, 256 );
&#160;m_fileName = p;
&#160;
1，string -&#62; CString&#160; 
CString.format(&#34;%s&#34;, string.c_str());&#160; 
用c_str()确实比data()要好.&#160; 
2，char -&#62; string&#160; 
string&#160;s(char *);&#160; 
你的只能初始化，在不是初始化的地方最好还是用assign().&#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2009/03/03/2209.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>auzn的Flex中对文本实现高亮显示的经典教程</title>
		<link>http://blog.minidx.com/2008/07/28/1178.html</link>
		<comments>http://blog.minidx.com/2008/07/28/1178.html#comments</comments>
		<pubDate>Mon, 28 Jul 2008 15:20:05 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[auzn]]></category>
		<category><![CDATA[DisplayObject]]></category>
		<category><![CDATA[Gskinner]]></category>
		<category><![CDATA[regexr]]></category>
		<category><![CDATA[字符串]]></category>
		<category><![CDATA[高亮]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/07/28/1178.html</guid>
		<description><![CDATA[下面是继KingnareStyle皮肤制作简介之后，auzn为我们带来的又一篇经典之作。这小子写起教程来简直是“一代宗师”，代码+说明+必要的截图，让人很容易理解。不废话了，下面是正文：
相信大家都看过Gskinner的FLEX/AIR正则验证程序(www.regexr.com),其中匹配字符串的高亮效果很好，移过时还可以显示字符串的详细信息:

这是在匹配的字符串处浮动了一个DisplayObject.
下面我们来尝试做这个效果.
注：本文英文版本：How to Highlight the Text in Flex(with Full Source Code)
 Demo &#124; Download Full Project









如何确定高亮块的位置及高宽是本文的重点。我们可以灵活运用TextField类的几个方法得到相关的数值:
1.getLineIndexOfChar(charIndex:int):int
Returns the zero-based index value of the line containing the character specified by the charIndex parameter.
2.getLineOffset(lineIndex:int):int
Returns the character index of the first character in the line that the lineIndex parameter specifies.
3.getLineLength(lineIndex:int):int
Returns the number of characters in a specific text line.
4.getLineIndexOfChar(charIndex:int):int
Returns the [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/07/28/1178.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex中如何通过formatString属性对DateField控件字符串进行格式化的例子</title>
		<link>http://blog.minidx.com/2008/07/24/1127.html</link>
		<comments>http://blog.minidx.com/2008/07/24/1127.html#comments</comments>
		<pubDate>Thu, 24 Jul 2008 14:23:11 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[DateField]]></category>
		<category><![CDATA[formatString]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[字符串]]></category>
		<category><![CDATA[格式化]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/07/24/1127.html</guid>
		<description><![CDATA[接下来的例子演示了MXML和ActionScript中如何通过formatString属性，对DateField控件字符串进行格式化。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整代码(或点击这里察看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;top&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:ApplicationControlBar&#160;dock=&#34;true&#34;&#62;
&#160; &#160; &#160; &#160; &#60;mx:Form&#160;styleName=&#34;plain&#34;&#62;
&#160; &#160; &#160; &#160; &#160; &#160; &#60;mx:FormItem&#160;label=&#34;formatString:&#34; direction=&#34;horizontal&#34;&#62;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#60;mx:Button&#160;label=&#34;YYYY/MM/DD&#34;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; click=&#34;dateField.formatString='YYYY/MM/DD';&#34;&#160;/&#62;
&#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/07/24/1127.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex中如何通过errorString属性在CheckBox控件上设置一个错误信息显示字符串的例子</title>
		<link>http://blog.minidx.com/2008/05/22/866.html</link>
		<comments>http://blog.minidx.com/2008/05/22/866.html#comments</comments>
		<pubDate>Thu, 22 May 2008 12:09:50 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[CheckBox]]></category>
		<category><![CDATA[errorString]]></category>
		<category><![CDATA[字符串]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/05/22/866.html</guid>
		<description><![CDATA[注册邮箱或者论坛用户以及下载类似于JDK之类的开发包的时候，都会有一个协议确认画面，需要打勾了才可以下一步。下面的例子就演示了这一过程：打勾之前下一步无效，鼠标移动到CheckBox的时候会显示一条信息。该信息利用了Flex中CheckBox控件的errorString属性。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整代码(或点击这里查看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;middle&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; &#160; private function checkBox_change(evt:Event):void {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if (checkBox.selected) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; checkBox.errorString = &#34;&#34;;
&#160; &#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/05/22/866.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex中如何通过设置restrict属性在TextInput控件中限制用户可以输入的字符串的例子</title>
		<link>http://blog.minidx.com/2008/05/16/851.html</link>
		<comments>http://blog.minidx.com/2008/05/16/851.html#comments</comments>
		<pubDate>Fri, 16 May 2008 11:30:41 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[restrict]]></category>
		<category><![CDATA[TextInput]]></category>
		<category><![CDATA[字符串]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/05/16/851.html</guid>
		<description><![CDATA[接下来的例子演示了Flex中如何通过设置restrict属性，在TextInput控件中限制用户可以输入的字符串。本例中在restrict属性中设置了&#8220;0-9\-&#8221;,也就是只允许用户输入0到9的数字以及间隔符（-）。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整代码(或点击这里查看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;middle&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; &#160; private function textInput_change(evt:Event):void {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; arrColl.addItem(evt);
&#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; ]]&#62;
&#160; &#160; &#60;/mx:Script&#62;
&#160;
&#160; &#160; &#60;mx:ArrayCollection&#160;id=&#34;arrColl&#34; /&#62;
&#160;
&#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/05/16/851.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 2/28 queries in 0.583 seconds using disk
Object Caching 424/815 objects using disk

Served from: blog.minidx.com @ 2012-02-10 01:46:49 -->
