2010-10-19 12 views
11

प्रोग्रामिंग के संदर्भ में "ऑफ़सेट" का क्या अर्थ है?प्रोग्रामिंग के संदर्भ में "ऑफ़सेट" का क्या अर्थ है?

क्या इसका मतलब शुरुआत में या दूरी से है?

String.offsetByCodePoints(int index, int codePointOffset) विधि क्या करती है? विधि प्रलेखन में "unpaired सरोगेट्स" क्या मतलब है?

+2

http://en.wikipedia.org/wiki/Offset_%28computer_science%29 –

+1

http: // en .wikipedia.org/wiki/Mapping_of_Unicode_characters # आपके प्रश्न के दूसरे भाग के लिए सरोगेट – dsetton

+0

धन्यवाद यह अब स्पष्ट है – skystar7

उत्तर

2

JavaDoc के अनुसार,

String.offsetByCodePoints(int index, int codePointOffset) 

इस वस्तु कि {@code codePointOffset} कोड अंक {@code सूचकांक} से समायोजित है सूचकांक देता है।

यहाँ अपने प्रश्न के पहले भाग के लिए उपयोग का एक उदाहरण है ...

int num = 0; 
num = "Test_String".offsetByCodePoints(0, 2); //num is 2 
num = "Test_String".offsetByCodePoints(3, 2); //num is 5 
num = "Test_String".offsetByCodePoints(9, 5); //Throws an exception since offset goes out-of-bounds 
+0

'num =" test_String ".offsetByCodePoints (3, 2); // num मेरे लिए 6' प्रिंट 5 है –

+0

क्षमा करें, "1 से 1" टाइपो। अब तय –

+0

धन्यवाद यह अभी स्पष्ट है – skystar7

संबंधित मुद्दे