.  string 转换为 NSString  

   std::string str("hello");

   NSString *str=[NSString stringWithString:str.c_str()];

   NSString *istr=[NSString stringWithString:@"zsh"];

    str=[istr cStringUsingEncoding: NSUTF8StringEncoding];
NSString *path= [[NSBundle mainBundle]pathForResource:@"nokia" ofType:@"mp3"]; char *tempPath=(char*)malloc(sizeof(path)+); NSString *soundPath=[[NSBundle mainBundle] pathForResource:@mp3"]; NSString* dirStr = [NSString stringWithFormat:@"%s",path];
NSString* filepath = [[NSBundle mainBundle] pathForResource:dirStr ofType:nil];
NSLog(filepath); . //NSString 转换为C 字符串 const char* destDir = [filepath UTF8String]; // NSURL *soundUrl=[[NSURL alloc] initFileURLWithPath:s]; .const char * to NSString char *str ="abc"; NSString *s = [NSString stringWithUTF8String:str];

http://blog.csdn.net/typename/article/details/6730183

NSString 与C++ string字符串的互转(转)的更多相关文章

  1. iOS - Swift String 字符串

    前言 public struct String public class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCodin ...

  2. [lua]紫猫lua教程-命令宝典-L1-01-09. string字符串函数库

    L1[string]01. ASCII码互转 小知识:字符串处理的几个共同的几点 1.字符串处理函数 字符串索引可以为负数 表示从字符串末尾开始算起 所有字符串处理函数的 字符串索引参数都使用 2.所 ...

  3. java普通对象和json字符串的互转

    一.java普通对象和json字符串的互转 java对象---->json 首先创建一个java对象: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 ...

  4. Java String字符串/==和equals区别,str。toCharAt(),getBytes,indexOf过滤存在字符,trim()/String与StringBuffer多线程安全/StringBuilder单线程—— 14.0

    课程概要 String 字符串 String字符串常用方法 StringBuffer StringBuilder String字符串: 1.实例化String对象 直接赋值  String str=& ...

  5. [CareerCup] 1.3 Permutation String 字符串的排列

    1.3 Given two strings, write a method to decide if one is a permutation of the other. 这道题给定我们两个字符串,让 ...

  6. c++ string 与 char 互转 以及base64

    c++ string 与 char 互转 很简单如下 ] = {'A','B','C','D','E'}; printf("%s\n",bts); //char to string ...

  7. 03-Java String字符串详解

    1.Java字符串String A.实例化String字符串:直接赋值(更合理一些,使用较多).使用关键字new. B.String内容的比较 // TODO Auto-generated metho ...

  8. C++学习38 string字符串的增删改查

    C++ 提供的 string 类包含了若干实用的成员函数,大大方便了字符串的增加.删除.更改.查询等操作. 插入字符串 insert() 函数可以在 string 字符串中指定的位置插入另一个字符串, ...

  9. C++学习37 string字符串的访问和拼接

    访问字符串中的字符 string 字符串也可以像字符串数组一样按照下标来访问其中的每一个字符.string 字符串的起始下标仍是从 0 开始.请看下面的代码: #include <iostrea ...

随机推荐

  1. 安装Ubuntu版本linux过程中没有提示设置root用户密码问题的解决办法

    原来ubunto不提倡设置root用户,系统安装成功后,root密码是随机的,那么在这种情况下如何得到root权限呐,具体方法如下: 终端中输入:sudo passwd root 此时重新设置原登录用 ...

  2. PHP:第六章——02正则基本语法

    <?php header("Content-Type:text/html;charset=utf-8"); //正则表达式的基本结构:匹配符.匹配模式.模式修饰符 //元字符 ...

  3. 快速切题 sgu136. Erasing Edges

    136. Erasing Edges time limit per test: 0.25 sec. memory limit per test: 4096 KB Little Johnny paint ...

  4. linux 命令 --while

    shell while 语法: while [条件判断式] do 程序 done 对 while 循环来讲,只要条件判断式成立,循环就会一直进行,直到条件判断式不成立,循环才会停止. 例如: 循环从1 ...

  5. New Concept English Two 26 70

    $课文68  纠缠不休 712. I crossed the street to avoid meeting him, but he saw me and came running towards m ...

  6. Entity Framework 入门

    Entity Framework的全称是ADO.NET Entity Framework,是微软开发的基于ADO.NET的ORM(Object/Relational Mapping)框架. Entit ...

  7. Kotlin Reference (十) Interfaces

    most from reference 接口 Kotlin中的接口非常类似于Java8,它们可以包含抽象方法的声明以及方法实现.与抽象类不同的是接口不能存储状态.它们可以具有属性,但这些需要是抽象的或 ...

  8. Oracle 分析函数及常用函数

    什么叫分析函数(Analytic function)? Oracle从8.1.6开始提供分析函数,分析函数用于计算基于组的某种聚合值,它和聚合函数的不同之处是 对于每个组返回多行,而聚合函数对于每个组 ...

  9. Android filesystem system rw(read/write) permission

    /********************************************************************************* * Android filesys ...

  10. MySQL 主从复制与读写分离

    1.MySQL主从复制入门 首先,我们看一个图: 影响MySQL-A数据库的操作,在数据库执行后,都会写入本地的日志系统A中. 假设,实时的将变化了的日志系统中的数据库事件操作,在MYSQL-A的33 ...