快,快到碗里来

快到碗里来的博客

winepot2005@gmail.com

http://github.com/inpot

快,快到碗里来

Android_studio_template_function

Android Studio Template Function

string activityToLayout(string)

This function converts an activity class-like identifer string, such as FooActivity, to a corresponding resource-friendly identifier string, such as activity_foo.

Arguments

See also

layoutToActivity

string camelCaseToUnderscore(string)

This function converts a camel-case identifer string, such as FooBar, to its corresponding underscore-separated identifier string, such as foo_bar.

Arguments

See also

underscoreToCamelCase

string escapeXmlAttribute(string)

This function escapes a string, such as Android's such that it can be used as an XML attribute value: Android&apos;s. In particular, it will escape ‘, “, < and &.

Arguments

See also

escapeXmlText

escapeXmlString

string escapeXmlText(string)

This function escapes a string, such as A & B's such that it can be used as XML text. This means it will escape < and >, but unlike escapeXmlAttribute it will not escape ‘ and “. In the preceeding example, it will escape the string to A &amp; B\s. Note that if you plan to use the XML text as the value for a resource value, you should consider using [`escapeXmlString`](#toc_escapexmlstring) instead, since it performs additional escapes necessary for string resources.

Arguments

See also

escapeXmlAttribute

escapeXmlString

string escapeXmlString(string)

This function escapes a string, such as A & B's such that it is suitable to be inserted in a string resource file as XML text, such as A &amp; B\s. In addition to escaping XML characters like < and &, it also performs additional Android specific escapes, such as escaping apostrophes with a backslash, and so on.

Arguments

See also

escapeXmlAttribute

escapeXmlText

string extractLetters(string)

This function extracts all the letters from a string, effectively removing any punctuation and whitespace characters.

Arguments

string classToResource(string)

This function converts an Android class name, such as FooActivity or FooFragment, to a corresponding resource-friendly identifier string, such as foo, stripping the ‘Activity’ or ‘Fragment’ suffix. Currently stripped suffixes are listed below.

Arguments

See also

activityToLayout

string layoutToActivity(string)

This function converts a resource-friendly identifer string, such as activity_foo, to a corresponding Java class-friendly identifier string, such as FooActivity.

Arguments

See also

activityToLayout

string slashedPackageName(string)

This function converts a full Java package name to its corresponding directory path. For example, if the given argument is com.example.foo, the return value will be com/example/foo.

Arguments

string underscoreToCamelCase(string)

This function converts an underscore-delimited string, such as foo_bar, to its corresponding camel-case string, such as FooBar.

Arguments

See also

camelCaseToUnderscore