此处Question_ids_delete
是一个类似“'1','2','3'
”的字符串,
我想在输入字符串中删除双引号,需要输出为'1','2','3'
DELIMITER $$
CREATE DEFINER = root
@ localhost
PROCEDURE delete_QandA
(userid INT,subjectId tinyint,chapterId tinyint,Question_ids_save text,Question_ids_delete text)
开始
DECLARE statement_ids_delete text DEFAULT'';
set statement_ids_delete = TRIM(REPLACE(Question_ids_delete,'“','')); IF(LENGTH(Question_ids_delete)> 0)然后
从products.my_class_room_subject_chapter_qanda删除 其中classroom_chapter_usr_id = userid &安培;&安培; classroom_subject_id = subjectId&& classroom_chapter_id = chapterId&& (statement_ids_delete)中的classroom_chapter_question_id;
END IF;
END
答案 0 :(得分:0)
加倍双引号。
Question_ids_delete.Replace("""","");
可选地
String sourcestring = "" '1','2','3' "";
String matchpattern = @"""";
String replacementpattern = @"";
Console.WriteLine(Regex.Replace(sourcestring,matchpattern,replacementpattern));
答案 1 :(得分:0)
使用:
REPLACE( field_with_double_quotes, '"', '' )
这将导致删除所有双引号。
要删除前导和尾随空格,请使用TRIM()
。
TRIM(REPLACE( " '1','2','3' ", '"', '' ))
将返回一个没有前导和尾随空格的字符串'1','2','3'
。
请参阅 :