Let's say i have an input where i ask the user to put just the letter of a card. Let's say "KdKc". Beside of showing the user a KDKC/kdkc/KdKc i would like to show the unicode for the suits. K⋄K♣
Anyone knows how do i do this conversion?
I am inserting it into table like this:
$hand = json_decode(file_get_contents("php://input"),true);
$hand_names = array('handNumber', 'hand');
$keys = array_keys($hand);
$columns = '';
$values = '';
foreach($column_names as $desired_key){ // Check the hand received. If blank insert blank into the array.
if(!in_array($desired_key, $keys)) {
$$desired_key = '';
}else{
$$desired_key = $hand[$desired_key];
}
$columns = $columns.$desired_key.',';
$values = $values."'".$$desired_key."',";
}
$query = "INSERT INTO hands_table(".trim($columns,',').") VALUES(".trim($values,',').")";
if(!empty($hand)){
$r = $this->mysqli->query($query) or die($this->mysqli->error.__LINE__);
$success = array('status' => "Success", "msg" => "Hand Created Successfully.", "data" => $hand);
$this->response($this->json($success),200);
}else
$this->response('',204); //"No Content" status
and showing through a ng-repeat
<tr ng-repeat="data in customers">
<td>{{data.hand}}</td>
<td><a href="#/edit-hand/{{data.handNumber}}" class="btn"> <i class="glyphicon glyphicon-edit"></i> Edit Hand</a></td>
</tr>
I appreciate the time!
How about creating a filter? Working plunker
app.filter('cardSymbol', function() {
return function(input) {
if (!input) {
return input;
}
input = input.replace(/s/g, '\u2660');
input = input.replace(/h/g, '\u2665');
input = input.replace(/d/g, '\u2666');
input = input.replace(/c/g, '\u2663');
return input;
}
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments