我需要从 XML 文件中删除回车,但我得到的只是一个带有一个框的 XML 文件(\ r)。我是这样写的:
string sourceFileName = textBox1.Text;
StreamReader sr = new StreamReader(sourceFileName);
String line;
String newLine = null;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
//Regex regex = new Regex(@"(\r\n|\r|\n)+");
newLine = line.Replace("\r\n", String.Empty);
//also tried line.Replace("\n", String.Empty).Replace("\r",String.Empty); , but no use
StreamWriter sw = new StreamWriter(@"C:\Users\manish\Desktop\output.xml");
sw.WriteLine(newLine);
sw.Close();
}
Run Code Online (Sandbox Code Playgroud)
这里可能有什么问题。
编辑:
这是示例:
3C 3F 78 6D 6C 20 76 …Run Code Online (Sandbox Code Playgroud) 我想获取从库中挑选或最近点击的图像的名称 -
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码:
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
AppDelegate *del = [[UIApplication sharedApplication]delegate];
[self dismissModalViewControllerAnimated:YES];
image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSLog(@"imagekbgfg=====>%@",image);
[self.imageView setImage:image];
imgName = [info objectForKey:UIImagePickerControllerOriginalImage];
del.mainImgName = imgName;
del.imageData = UIImageJPEGRepresentation(image, 1.0);
del.imageApp = image;
}
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
{
image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?