Tanoda
QRcode/Scripts/Utility.cs
Go to the documentation of this file.
1
using
System.Text.RegularExpressions;
2
using
UnityEngine
;
3
4
public
class
Utility
5
{
6
public
static
bool
CheckIsUrlFormat
(
string
strValue)
7
{
8
return
CheckIsFormat
(
"(http://)?([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?"
, strValue);
9
}
10
11
public
static
bool
CheckIsFormat
(
string
strRegex,
string
strValue)
12
{
13
if
(strValue !=
null
&& strValue.Trim() !=
string
.Empty)
14
{
15
var regex =
new
Regex(strRegex);
16
return
regex.IsMatch(strValue);
17
}
18
19
return
false
;
20
}
21
22
23
//Converter
24
25
public
static
Sprite
Texture2DToSprite
(Texture2D texture)
26
{
27
var sprite = Sprite.Create(texture,
new
Rect(0, 0, texture.width, texture.height),
new
Vector2(0.5f, 0.5f),
28
100.0f);
29
return
sprite;
30
}
31
}
Utility
Definition:
QRcode/Scripts/Utility.cs:5
Utility.CheckIsFormat
static bool CheckIsFormat(string strRegex, string strValue)
Definition:
QRcode/Scripts/Utility.cs:11
Utility.Texture2DToSprite
static Sprite Texture2DToSprite(Texture2D texture)
Definition:
QRcode/Scripts/Utility.cs:25
Utility.CheckIsUrlFormat
static bool CheckIsUrlFormat(string strValue)
Definition:
QRcode/Scripts/Utility.cs:6
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
QRcode
Scripts
Utility.cs
Generated by
1.9.3