Bản mẫu:Str find/doc

Bách khoa toàn thư mở Wikipedia

Cách sử dụng[sửa mã nguồn]

{{Str find|chữ|sub_string}} = Position of first appearance of sub_string in chữ.

Các ví dụ[sửa mã nguồn]

In the examples, the string to be searched is Abcdefghijklm:

  • A; 1
  • a; -1
  • def; 4
  • klm; 11
  • zyx; -1
  • empty;klm;-1
  • empty;empty; 1
  • Case sensitive.
  • Returns -1 if sub_string not found
  • Character position is 1 based (not 0 based as usual in calculations).
  • Warning: if sub_string is empty, then this routine will return 1 !!! This case will often have to be handled specially.

Dữ liệu bản mẫu[sửa mã nguồn]

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho Str find

A template to find the numeric position of first appearance of ''sub_string'' in ''text''

Tham số bản mẫu

Tham sốMiêu tảKiểuTrạng thái
Text1

The text to search within

Chuỗi dàibắt buộc
Sub_string2

The string to be searched within the text

Chuỗi dàibắt buộc

Xem thêm[sửa mã nguồn]