C String詳解 小白專用

2021-10-08 19:26:58 字數 1097 閱讀 2739

#include

"string"

string s =

"hello world!!!"

;

char temp=

"hello world!!!"

;string s = temp;

string s =

"hello world!!!"

;char

*temp =

(char

*)s.

c_str()

;//此處一定要加強制型別轉化,c_str()返回的是乙個臨時指標,不能對其進行賦值操作

string s =

"hello world!!!"

;int n = s.

size()

;

string s1 =

"hello world!!!"

;string s2 = s1.

substr

(start,len)

;//起始於start,長度為len

字串比較

string s1 =

"aabbaa"

;string s2 =

"aabbaa1"

;cout

(s2)

string s1 =

"aabbaa"

;string s2 =

"aabbaa1"

;s1.

(s2)

;//方法一

s1+=s2;

//方法二

string s =

"aabbaa"

;string s2 = s.

substr

(n);

//去掉前n個字元

持續更新中、

我是傑出的小茄子,乙個菜但是很努力的人。

dom總結(小白專用)

html dom 定義了訪問和操作 html 文件的標準方法。dom 就是document object model,文件物件模型。根據 w3c 的 html dom 標準,html 文件中的所有內容都是節點 整個文件是乙個文件節點 每個 html 元素是元素節點 也就是說網頁的html標籤元素是元...

Redis安裝方法(小白專用)

鄭重宣告 本安裝教程親測成功,且純粹小白級別,如有覺得不專業的,你咬我啊。之前就聽說了redis這個東東,一直都不明覺厲,今天決定裝來玩玩。因為redis的作者認為linux的網路效能已經是大家都有目共睹了,鄙視windows,所以redis的執行環境是在linux下的。所需的軟硬環境 1 linu...

linux PXE裝機詳解 非常詳細,小白專用

環境準備 ip配置 配置檔案路徑 etc sysconfig network scripts ifcfg eth0 增加 dhcp服務配置 位址分發 配置檔案路徑 etc dhcp dhcpd.conf tftp服務配置 簡單檔案傳輸 配置檔案路徑 etc xinetd.d tftp 檔案存放目錄 ...