简体   繁体   中英

iPhone:How to store apostrophe(') sign in sqlite database

In UITextView I write my text and on the button click this text store in database but when I use apostrophe(') sign in my text. My query shows me error near apostrophe sign then please tell me how to insert apostrophe sign in sqlit database.

thanx in advance...

您可以尝试将文本中的撇号加倍(即''而不是' )。

This may be of some help as well when you want to replace a single quote with two double quotes.

Method:

 - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement

Example:

[someString stringByReplacingOccurrencesOfString:@"'" withString:@"''"]

你应该将撇号加倍“加倍”

A string constant is formed by enclosing the string in single quotes ('). A single quote within the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes using the backslash character are not supported because they are not standard SQL.

http://www.sqlite.org/lang_expr.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM