package com.myapp import android.content.Context import com.myapp.R.string.*; fun Context.getAppTitle() = getString(R.string.app_title) fun getAppTitle(context: Context) { return context.getString(app_title) } fun getLongString(context: Context) = context.getString(R.string.long_string) fun bar(text: String) = text fun foo(context: Context) { val name = "Vasya" val otherName = context.getString(R.string.no_resource) val cancel = context.getString(android.R.string.cancel) val text = context.getString(R.string.format_string, name) val text = context.getString(R.string.format_string, otherName) val emptyString = context.getString(R.string.empty_string) val someInt = context.resources.getInteger(R.integer.some_int) context.getString(R.string.no_resource) bar(context.getResources().getString(R.string.compex_format_string, "111", "222", "333")) val invalid = with(context) { getString(R.string.invalid_format, name, otherName) } }