คลายแฟ้มส่วนข้อความอยู่ว่าหลังจากแน่ใจว่าตัวละครในกระพือภาพ

รหัสตัวอย่าง

0
0

N

String s = "one.two";

//Removes everything after first '.'
String result = s.substring(0, s.indexOf('.'));
print(result);
---------------------------------------------
to keep it even simpeler, with 's' as the initial string one.two then 
s.substring(0, s.indexOf('.')) produces: one 
and s.substring(s.indexOf('.') + 1) produces: two
---------------------------------------------

In case there are more than one '.' in the String it will use the first occurrance. 
If you need to use the last one (to get rid of a file extension, for example) change 
indexOf to lastIndexOf. If you are unsure there is at least one occurrance, you 
should also add some validation to avoid triggering an exception.

String s = "one.two.three";

//Remove everything after last '.'
var pos = s.lastIndexOf('.');
String result = (pos != -1)? s.substring(0, pos): s;
print(result);

หน้าคล้ายกัน

คล้ายกันหน้ากับตัวอย่าง

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังหน้ากับตัวอย่างอยู่ในหมวดหมู่