小编MTA*_*MTA的帖子

从String中删除空格

我有很多看起来像这样的字符串:

current            affairs
Run Code Online (Sandbox Code Playgroud)

我想让字符串成为:

current affairs
Run Code Online (Sandbox Code Playgroud)

我尝试使用,Trim()但它不会做这个工作

c#

4
推荐指数
2
解决办法
248
查看次数

来自 androidx.core:core:1.0.0 和 com.android.support:support-compat:26.1.0 的重复类

这是我的 build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    google()
}


android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        multiDexEnabled true
        minSdkVersion 16
        targetSdkVersion 26
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
        renderscriptTargetApi 22
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        debug {
            debuggable true
            buildConfigField "boolean", "CRASH_LOGGING", "true"
            applicationIdSuffix ".dev" …
Run Code Online (Sandbox Code Playgroud)

android gradle google-play-services android-studio android-gradle-plugin

4
推荐指数
2
解决办法
5531
查看次数

android中的音乐库

在objective-c中有一个类将所有Ipod歌曲带到数组,我正在寻找可以连接到设备音乐库的android中的东西.

java media android

3
推荐指数
1
解决办法
2292
查看次数

在html中嵌入mp3

我使用此代码将mp3文件嵌入到html中:

<EMBED SRC="mp3 link" HEIGHT=60 WIDTH=300>];
Run Code Online (Sandbox Code Playgroud)

问题是浏览器下载文件而不是播放它,有什么方法可以在缓冲区或类似的东西中进行吗?

因为我希望用户不会等待.

html

3
推荐指数
2
解决办法
4万
查看次数

NSData字节到字符串

我得到的NSData字节看起来像这样:

    2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d353731 35343039 37373139
    34383437 34303832 30333533 30383232 380d0a43 6f6e7465 6e742d44 6973706f 73697469 6f6e3a20 
    666f726d 2d646174 613b206e 616d653d 2266696c 65223b20 66696c65 6e616d65 
    3d224265 61636820 426f7973 202d2047 6f6f6420 56696272 6174696f 6e732e6d 
Run Code Online (Sandbox Code Playgroud)

我想将它转换为NSString,我试过这个方法,但它给了我一个字符串的零:

NSString* postInfo = [[NSString alloc] initWithBytes:[postDataChunk bytes] length:[postDataChunk length] encoding:NSUTF8StringEncoding];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c

3
推荐指数
1
解决办法
8653
查看次数

iOS 6 AutoRotate在UiNavigationController中

我的应用程序中有UiNavigationController.我希望只有一个屏幕可以旋转,所以我放入这个类:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}

-(BOOL)shouldAutorotate {
    return YES;
}

-(NSInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)

但发生的问题是在ecery屏幕上应用程序旋转发生.我怎么能禁用它?

iphone xcode objective-c ios

3
推荐指数
1
解决办法
4378
查看次数

分配点击到网格

我尝试添加我的网格点击处理程序:

<Grid x:Name="LayoutRoot" Background="#FF1F1F1F" Tap="OnTap">........</Grid>
Run Code Online (Sandbox Code Playgroud)

InitializeComponent();我得到这个:

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll

Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 14 Position: 58]

    {System.Windows.Markup.XamlParseException: Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 14 Position: 58]
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at *.NowPlayingPageControl.InitializeComponent()
   at *.NowPlayingPageControl..ctor()}
Run Code Online (Sandbox Code Playgroud)

c# silverlight windows-phone-7

3
推荐指数
1
解决办法
1152
查看次数

带有String组头的LongListSelector

我有这门课AlphaKeyGroup:

public class AlphaKeyGroup<T> : List<T>
{
    /// <summary>
    /// The delegate that is used to get the key information.
    /// </summary>
    /// <param name="item">An object of type T</param>
    /// <returns>The key value to use for this object</returns>
    public delegate string GetKeyDelegate(T item);

    /// <summary>
    /// The Key of this group.
    /// </summary>
    public string Key { get; private set; }

    /// <summary>
    /// Public constructor.
    /// </summary>
    /// <param name="key">The key for this group.</param>
    public AlphaKeyGroup(string key) …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf windows-phone-7 windows-phone-8

3
推荐指数
1
解决办法
2569
查看次数

动态更改Marionette ItemView模板

我有这样ItemViewMarionette:

App.View.MovieListItem = Marionette.ItemView.extend({
tagName: 'li',
className: 'movie',
model: App.Model.Movie,
id: function() {
    return 'movie-'+this.model.get('imdb')
},

initialize: function () {
    this.render();
},

template: _.template('<a href="javascript:;">'+
        '<i class="fa fa-eye fa-3"></i>'+
        '<span class="cover"></span>'+
        '<strong><%= title %></strong>'+
        '<small><%- year %></small>'+
        '<small2>Cached</small2>'+
    '</a>'),
});
Run Code Online (Sandbox Code Playgroud)

我想知道是否可以动态创建模板?因为有些时候我想要(基于检查某些东西的方法)来删除small2标签.

html javascript backbone.js marionette

3
推荐指数
1
解决办法
3142
查看次数

快速从NSDictionary读取数据

我正在使用此代码从读取数据NSDictionary

let itemsArray: NSArray = response.objectForKey("items") as! NSArray;
let nextPageToken: String = response.objectForKey("nextPageToken") as! String

var videoIdArray: [String] = []

for (item) in itemsArray {
      let videoId: String? = item.valueForKey("id")!.valueForKey("videoId") as? String
      videoIdArray.append(videoId!)
}
Run Code Online (Sandbox Code Playgroud)

但是,当我items还是nextPageToken不存在,我得到这个错误:

fatal error: unexpectedly found nil while unwrapping an Optional value
Run Code Online (Sandbox Code Playgroud)

知道为什么吗?我该如何解决?

iphone json nsdictionary ios swift

3
推荐指数
1
解决办法
2万
查看次数