.  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. UVA-10570 Meeting with Aliens (枚举+贪心)

    题目大意:将一个1~n的环形排列变成升序的,最少需要几次操作?每次操作可以交换任意两个数字. 题目分析:枚举出1的位置.贪心策略:每次操作都保证至少一个数字交换到正确位置上. # include< ...

  2. LeetCode 48

    这种方法首先对原数组取其转置矩阵,然后把每行的数字翻转可得到结果,如下所示(其中蓝色数字表示翻转轴): 1  2  3  1  4  7  7  4  1 4  5  6 -->  2  5   ...

  3. 019PHP基础知识——函数(二)

    <?php /** * 变量的作用范围 * 函数体内的变量只作用于函数体内. */ /*$bbs="bbs.blog.com"; function say(){ $bbs=& ...

  4. rabbitmq 对多服务器p2p模式配置的一个测试

    一直对rabbitmq p2p 模式的多服务器下做相同配置的 各个服务器数据接受情况比较好奇 今天有空测试了下 xml 文件 <?xml version="1.0" enco ...

  5. hdu5618

    题解: CDQ分治 三重分治 第一重排序 第二重CDQ 第三重树状数组 代码: #include<cstdio> #include<cmath> #include<cst ...

  6. redux-thunk中间件源码

    浅析redux-thunk中间件源码 大多redux的初学者都会使用redux-thunk中间件来处理异步请求,其理解简单使用方便(具体使用可参考官方文档).我自己其实也一直在用,最近偶然发现其源码只 ...

  7. 定时器Timer&ScheduledThreadPoolExecutor

    定时器Timer&ScheduledThreadPoolExecutor /** * @ClassName: TimerTest * @author: daniel.zhao * @date: ...

  8. 冒泡排序算法-Python实现

    #-*- coding: UTF-8 -*- import numpy as np def BubbleSort(a): for i in xrange(0, a.size): for j in xr ...

  9. HDU 1251 统计难题(字典树)

    统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submi ...

  10. [Android] 开发第十一天

    MainActivity.java 代码如下: package com.oazzz.test9; import android.support.annotation.Nullable; import ...