简体   繁体   English

如何在希伯来语中使用 String.Format

[英]How to use String.Format with hebrew

I'm currently using string format.我目前正在使用字符串格式。 Works perfectly in my other languages but I am having trouble with Hebrew.在我的其他语言中完美运行,但我在使用希伯来语时遇到了麻烦。

var msg = string.Format("{קיבלת בקשה חדשה להפנייה מ{0} ו {1} {2", "test1", "test2", "test3");

this crashes and the hebrew text is underlined saying this is an invalid placeholder.这会崩溃,并且希伯来语文本带有下划线,表示这是一个无效的占位符。

May I ask how do I handle hebrew text with String.Format请问如何使用 String.Format 处理希伯来语文本

Try to use string interpolation 尝试使用字符串插值

var test1 = "test1";
var test2 = "test2";
var test3 = "test3";
var msg = $"{test3} {test2} ו {test1} קיבלת בקשה חדשה להפנייה מ";
     // 1
    string msg1 = $"{"קיבלת בקשה חדשה להפנייה מ"} {"test1"} {"ו"} {"test3"} 
    {"test2"}";

    // 2
    string test1 = "test1";
    string test2 = "test2";
    string test3 = "test3";

     // 2.1
    string msg2 = $"קיבלת בקשה חדשה להפנייה מ{test1} ו {test3} {test2}  ";
    // 2.2
    string msg3 = $"{"קיבלת בקשה חדשה להפנייה מ"} {test1} {"ו"} {test3} {test2}";


    // 3
    string startMessage = "קיבלת בקשה חדשה להפנייה מ";
    string continueMessage = "ו";

    // 3.1
    string msg4 = string.Format("{0} {1} {2} {3} {4}", startMessage, test1, 
     continueMessage, test3, test2);
    // 3.2
    string msg5 = $"{startMessage} {test1} {continueMessage} {test3} {test2}";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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