I Have an Array like this,
img = image.convert('RGB')
cropbox = img.getbbox()
image_1 = img.crop(cropbox)
I Want to convert it to string without using implode method anyother way is there? And Also i want to remove $cart_remove_arr from $cart_value_arr the array_diff method i used it is correct?
答案 0 :(得分:4)
You can use string[] x = new string[dt.Rows.Count];
string[] y = new string[dt.Rows.Count];
for (int i = 0; i<dt.Rows.Count; i++)
{
x[i] = dt.Rows[i][0].ToString();
y[i] = int.Parse(dt.Rows[i][1]).ToString("C2");
}
json_encode
This will also work on multi dimensional arrays
Will result to:
<?php
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode($arr);
?>
答案 1 :(得分:1)
Another way is the classic int check_for_files(){
FILE *fp;
int files_set;
char ch;
files_set = 0;
while(!files_set){
fp = fopen("file", "r");
if(fp != NULL){
content_length = 0;
while(ch=getc(fp) != EOF){
content_length++;
}
fclose(fp);
files_set = 1;
return files_set;
}
else{
files_set = 0;
}
}
return 1;
}
int main(int argc, char *argv[]) {
// Main function the get the application UI
GtkWidget *window;
GdkPixbuf *icon;
GtkWidget *grid;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 500, 300);
gtk_container_set_border_width(GTK_CONTAINER(window), 15);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
int pid = fork();
if (pid == 0){
int files_set = check_for_files();
printf("files outside: %d\n",files_set);
gtk_window_set_title(GTK_WINDOW(window), "Files are present!");
}
else{
icon = create_pixbuf("net.png");
gtk_window_set_icon(GTK_WINDOW(window), icon);
// Get the grid
get_grid(window);
gtk_widget_show_all(window);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_object_unref(icon);
gtk_main();
}
}
plus foreach
string concatenation
答案 2 :(得分:1)
Yet another way is to use SELECT
T1.BPT,
T1.BC,
T1.ST
FROM Mytable T1,
Mytable T2
WHERE T1.BEN_PROD_TYP_CD IN ('NH')
AND ((T1.ST = T2.ST
AND T1.BC = 'ABH6G')
OR (T1.ST <> T2.ST
AND (T1.BC = 'ABH6G'
OR T1.BC IS NULL)));
(http://php.net/manual/en/function.serialize.php), as simple as...
serialize()
This can handle most types and $string = serialize($arr);
to rebuild the original value.
答案 3 :(得分:0)
Android Studio