TAILIEUCHUNG - Mastering Joomla! 1.5 Extension and Framework Development phần 2

Tham khảo tài liệu 'mastering joomla! extension and framework development phần 2', công nghệ thông tin, quản trị mạng phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 2 When dealing with English characters UTF-8 uses the same encodings as ASCII and ANSII. This has a purposeful consequence UTF-8 encoded strings that use these characters appear identical to their ASCII and ANSII alternatives. Applications that are Unicode unaware are therefore able to handle many UTF-8 strings. One such application that is not Unicode aware is PHP. We therefore have to be careful when manipulating strings. PHP assumes all characters are eight bits one byte but because UTF-8 encoded characters can be longer this can cause corruption of Unicode data. There is a PHP module mbstring which adds support for multi-byte character encodings unfortunately not all PHP systems have the mbstring module. In Joomla we are provided with the static JString class this class allows us to perform many of the normal string manipulation functions with UTF-8 characters. This example demonstrates how we can use JString to convert a string to upper case. Note that the method name is identical to the PHP function we would normally use string JString strtoupper string The following table describes the PHP string functions and the corresponding JString methods PHP Function JString method Description strpos strpos Finds the first occurrence of a string in a string. substr substr Gets a portion of a string. strtolower strtolower Converts a string to lowercase. strtoupper strtoupper Converts a string to uppercase. strlen strlen Counts the length of a string. str_ireplace str_ireplace Substitutes occurrences of a string with another string in a string case insensitive . str_split str_split Splits a string into an array. strcasecmp strcasecmp Compares strings. strcspn strcspn Gets the length of the string before characters from the other parameters are found. stristr stristr Finds the first occurrence of a string in a string case insensitive . strrev strrev Reverses a string. strspn strspn Counts the longest segment of a string containing specified characters. .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.