[問題] 如何做到給一個string轉成變數或涵式名稱
譬如從一個字串內容譬如叫做 "name"
如何將字串"name"轉成其實是一個變數名稱(string name="xxx")
感謝~
--
推
04/26 21:48, , 1F
04/26 21:48, 1F
→
04/26 21:49, , 2F
04/26 21:49, 2F
推
04/26 21:51, , 3F
04/26 21:51, 3F
→
04/26 21:54, , 4F
04/26 21:54, 4F
→
04/26 21:57, , 5F
04/26 21:57, 5F
推
04/26 22:38, , 6F
04/26 22:38, 6F
→
04/26 22:39, , 7F
04/26 22:39, 7F
→
04/26 22:39, , 8F
04/26 22:39, 8F
→
04/26 22:40, , 9F
04/26 22:40, 9F
→
04/26 22:40, , 10F
04/26 22:40, 10F
→
04/26 22:41, , 11F
04/26 22:41, 11F
→
04/26 22:41, , 12F
04/26 22:41, 12F
→
04/26 22:43, , 13F
04/26 22:43, 13F
→
04/26 22:44, , 14F
04/26 22:44, 14F
→
04/26 22:46, , 15F
04/26 22:46, 15F
其實故事是這樣 某份CPP檔會去call android層
xxx.cpp---
call_anroid("name2");
某段cpp 涵式去mapping到android code的一個涵式
[c++]void call_anroid(string) <--->[java] void Call_Android(string)
xxx.java---
int name1=1 , name2=2, name3 =3;
void Call_Anroid(string s)
{
//這裡想把s轉成某個整數變數的名稱;
//可以變成func(name2);
}
void func(int value)
{
}_
→
04/26 22:47, , 16F
04/26 22:47, 16F
→
04/26 22:47, , 17F
04/26 22:47, 17F
→
04/26 22:49, , 18F
04/26 22:49, 18F
→
04/26 22:49, , 19F
04/26 22:49, 19F
推
04/26 22:50, , 20F
04/26 22:50, 20F
→
04/26 23:06, , 21F
04/26 23:06, 21F
→
04/26 23:06, , 22F
04/26 23:06, 22F
→
04/26 23:07, , 23F
04/26 23:07, 23F
→
04/26 23:08, , 24F
04/26 23:08, 24F
→
04/26 23:09, , 25F
04/26 23:09, 25F
→
04/26 23:10, , 26F
04/26 23:10, 26F
→
04/26 23:12, , 27F
04/26 23:12, 27F
→
04/26 23:12, , 28F
04/26 23:12, 28F
推
04/26 23:13, , 29F
04/26 23:13, 29F
→
04/26 23:13, , 30F
04/26 23:13, 30F
→
04/26 23:15, , 31F
04/26 23:15, 31F
→
04/26 23:15, , 32F
04/26 23:15, 32F
→
04/26 23:34, , 33F
04/26 23:34, 33F
→
04/26 23:34, , 34F
04/26 23:34, 34F
→
04/26 23:34, , 35F
04/26 23:34, 35F
→
04/26 23:40, , 36F
04/26 23:40, 36F
→
04/26 23:42, , 37F
04/26 23:42, 37F
→
04/26 23:42, , 38F
04/26 23:42, 38F
→
04/26 23:42, , 39F
04/26 23:42, 39F
→
04/26 23:42, , 40F
04/26 23:42, 40F
→
04/26 23:44, , 41F
04/26 23:44, 41F
→
04/26 23:44, , 42F
04/26 23:44, 42F
→
04/26 23:45, , 43F
04/26 23:45, 43F
→
04/27 00:37, , 44F
04/27 00:37, 44F
→
04/27 00:39, , 45F
04/27 00:39, 45F
→
04/27 00:39, , 46F
04/27 00:39, 46F
→
04/27 00:40, , 47F
04/27 00:40, 47F
→
04/27 00:41, , 48F
04/27 00:41, 48F
※ 編輯: hateexam 來自: 124.8.150.180 (04/28 01:21)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
AndroidDev 近期熱門文章
PTT數位生活區 即時熱門文章